Submission #2018589


Source Code Expand

#include <iostream>
#include <ctime>
using namespace std;

int n, a[100009];

void shuffle(int p) {
	for (int i = p; i < n; i++) swap(a[i], a[i - p]);
}
bool isperm() {
	for (int i = 0; i < n; i++) { if (a[i] != i) return false; }
	return true;
}

int main() {
	srand((unsigned)time(NULL));
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	while (true) {
		if (isperm() == true)break;
		int I = rand() % (n - 1) + 1;
		cout << I << endl;
		shuffle(I);
	}
	return 0;
}

Submission Info

Submission Time
Task B - Many Swaps Sorting
User E869120
Language C++14 (GCC 5.4.1)
Score 0
Code Size 496 Byte
Status WA
Exec Time 2103 ms
Memory 4480 KB

Judge Result

Set Name Sample Subtask1 Subtask2 All
Score / Max Score 0 / 0 0 / 300 0 / 400 0 / 200
Status
WA × 2
WA × 7
WA × 8
TLE × 5
WA × 9
TLE × 13
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt
Subtask1 00_example_01.txt, s1_01.txt, s1_02.txt, s1_03.txt, s1_04.txt, s1_05.txt, s1_06.txt
Subtask2 00_example_01.txt, 00_example_02.txt, s1_01.txt, s1_02.txt, s1_03.txt, s1_04.txt, s1_05.txt, s1_06.txt, s2_07.txt, s2_08.txt, s2_09.txt, s2_10.txt, s2_11.txt
All 00_example_01.txt, 00_example_02.txt, s1_01.txt, s1_02.txt, s1_03.txt, s1_04.txt, s1_05.txt, s1_06.txt, s2_07.txt, s2_08.txt, s2_09.txt, s2_10.txt, s2_11.txt, s3_12.txt, s3_13.txt, s3_14.txt, s3_15.txt, s3_16.txt, s3_17.txt, s3_18.txt, s3_19.txt, s3_20.txt
Case Name Status Exec Time Memory
00_example_01.txt WA 1 ms 256 KB
00_example_02.txt WA 34 ms 256 KB
s1_01.txt WA 1 ms 256 KB
s1_02.txt WA 3 ms 256 KB
s1_03.txt WA 3 ms 256 KB
s1_04.txt WA 1 ms 256 KB
s1_05.txt WA 12 ms 256 KB
s1_06.txt WA 1 ms 256 KB
s2_07.txt TLE 2103 ms 3456 KB
s2_08.txt TLE 2103 ms 3584 KB
s2_09.txt TLE 2103 ms 3712 KB
s2_10.txt TLE 2103 ms 3712 KB
s2_11.txt TLE 2103 ms 3712 KB
s3_12.txt TLE 2103 ms 3968 KB
s3_13.txt TLE 2103 ms 4352 KB
s3_14.txt TLE 2103 ms 3968 KB
s3_15.txt TLE 2103 ms 3968 KB
s3_16.txt TLE 2103 ms 4480 KB
s3_17.txt TLE 2103 ms 4480 KB
s3_18.txt TLE 2103 ms 4480 KB
s3_19.txt TLE 2103 ms 4480 KB
s3_20.txt WA 1 ms 256 KB