Submission #237535

# Submission time Handle Problem Language Result Execution time Memory
237535 2020-06-07T08:08:50 Z NONAME Karte (COCI18_karte) C++17
0 / 120
1000 ms 2296 KB
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define el '\n'
using namespace std;

typedef long long ll;
const int N = 5e5 + 10;

int n, k, a[N];

bool gd(int x) {
    int cur = 0;

    for (int j = 0; j < n; j++)
        if (a[(j + x) % n] > cur)
            cur++;

    return cur == k;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n >> k;

    for (int i = 0; i < n; ++i)
        cin >> a[i];

    sort(a, a + n);

    for (int i = 0; i < n; ++i)
        if (gd(i)) {
            for (int j = 0; j < n; ++j)
                cout << a[(i + j) % n] << ' ';

            return 0;
        }

    cout << -1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 768 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1097 ms 1152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 2296 KB Time limit exceeded
2 Halted 0 ms 0 KB -