# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1007510 | 2024-06-25T05:12:06 Z | The_Samurai | Gondola (IOI14_gondola) | C++17 | 11 ms | 2124 KB |
#include "gondola.h" #include "bits/stdc++.h" using namespace std; int valid(int n, int a[]) { int last = -1; set<int> st; for (int i = 0; i < 2 * n; i++) { if (a[i % n] >= n) continue; st.insert(a[i % n]); if (last != -1 and (a[last % n] + i - last - 1) % n != a[i % n] - 1) return 0; last = i; } return st.size() == n; } //---------------------- const int mod = 1e9 + 9; int replacement(int n, int a[], int replacementSeq[]) { const int N = 2e5 + 5; vector<int> owns(N, -1), old(n); int any = -1, last = -1; for (int i = 0; i < n; i++) { if (a[i] <= n) continue; owns[a[i]] = i; if (any == -1 or a[any] < a[i]) any = i; } for (int i = 0; i < 2 * n; i++) { if (a[i % n] <= n) last = i; if (last == -1) continue; old[i % n] = (a[last % n] + i - last - 1) % n + 1; } if (last == -1) { for (int i = 0; i < n; i++) old[i] = i + 1; } int mx = *max_element(a, a + n), z = 0; for (int i = n + 1; i <= mx; i++) { if (owns[i] != -1) { replacementSeq[z++] = old[owns[i]]; old[owns[i]] = i; } else { replacementSeq[z++] = old[any]; old[any] = i; } } return z; } //---------------------- int countReplacement(int n, int a[]) { if (!valid(n, a)) return 0; const int N = 1e6 + 5; vector<int> owns(N, -1); for (int i = 0; i < n; i++) { cout << a[i] << ' '; } cout << -1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1116 KB | Output is correct |
2 | Correct | 0 ms | 1116 KB | Output is correct |
3 | Correct | 0 ms | 1116 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 1 ms | 1112 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1112 KB | Output is correct |
2 | Correct | 1 ms | 1116 KB | Output is correct |
3 | Correct | 1 ms | 1116 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 0 ms | 1116 KB | Output is correct |
6 | Correct | 1 ms | 1116 KB | Output is correct |
7 | Correct | 0 ms | 1116 KB | Output is correct |
8 | Correct | 1 ms | 1112 KB | Output is correct |
9 | Correct | 1 ms | 1116 KB | Output is correct |
10 | Correct | 1 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1116 KB | Output is correct |
2 | Correct | 1 ms | 1112 KB | Output is correct |
3 | Correct | 0 ms | 1116 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 0 ms | 1116 KB | Output is correct |
6 | Correct | 1 ms | 1116 KB | Output is correct |
7 | Correct | 0 ms | 1116 KB | Output is correct |
8 | Correct | 1 ms | 1116 KB | Output is correct |
9 | Correct | 1 ms | 1116 KB | Output is correct |
10 | Correct | 1 ms | 1116 KB | Output is correct |
11 | Correct | 6 ms | 1628 KB | Output is correct |
12 | Correct | 7 ms | 1884 KB | Output is correct |
13 | Correct | 7 ms | 1556 KB | Output is correct |
14 | Correct | 6 ms | 1628 KB | Output is correct |
15 | Correct | 11 ms | 2124 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |