Submission #113224

# Submission time Handle Problem Language Result Execution time Memory
113224 2019-05-24T11:14:32 Z tutis Karte (COCI18_karte) C++17
36 / 120
915 ms 2424 KB
/*input
6 4
0
2
5
2
0
1
*/
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	clock_t pradzia = clock();
	ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	while ((clock() - pradzia) * 10 <= 9 * CLOCKS_PER_SEC)
	{
		random_shuffle(a, a + n);
		int b = 0;
		for (int i : a)
		{
			if (b < i)
				b++;
		}
		if (b == k)
		{
			reverse(a, a + n);
			for (int i : a)
				cout << i << " ";
			cout << "\n";
			return 0;
		}
	}
	cout << "-1\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 902 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 902 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 902 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 902 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 902 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 902 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 902 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 904 ms 768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 903 ms 1156 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 915 ms 2424 KB Output isn't correct
2 Halted 0 ms 0 KB -