Submission #47105

# Submission time Handle Problem Language Result Execution time Memory
47105 2018-04-27T15:34:19 Z Bruteforceman Karte (COCI18_karte) C++11
12 / 120
165 ms 12056 KB
#include "bits/stdc++.h"
using namespace std;
int a[500010];
int b[500010];

int main(int argc, char const *argv[])
{
	ios_base :: sync_with_stdio (false);
	cin.tie (0);

	int n, k;
	cin >> n >> k;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	k = n - k;
	for(int i = 0; i < n; i++) {
		b[i] = a[(i + k) % n];
	}
	int bad = 0;
	int good = 0;
	for(int i = 0; i < n; i++) {
		if(bad >= b[i]) {
			++good;
		} else {
			++bad;
		}
	}
	if(good == k) {
		for(int i = 0; i < n; i++) {
			cout << b[i] << " ";
		}
		cout << endl;
	} else {
		cout << -1 << endl;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 508 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 684 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 796 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 852 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 2816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 5236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 165 ms 12056 KB Output isn't correct
2 Halted 0 ms 0 KB -