# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
494110 | 2021-12-14T11:27:02 Z | ahmeteren | Gondola (IOI14_gondola) | C++17 | 26 ms | 2284 KB |
#include <bits/stdc++.h> #include "gondola.h" using namespace std; int valid(int n, int inputSeq[]) { int mn = 1e7, start = 0, it = 0; vector<int> vec(n); for(int i = 0; i < n; i++) { if(inputSeq[i] < mn) { mn = inputSeq[i]; start = i; } } for(int i = start; i < start + n; i++) { vec[it] = inputSeq[i % n]; it++; } int cur = mn; for(int i = 0; i < n; i++, cur++) { if(vec[i] > n) continue; if(vec[i] != cur) { return 0; } } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { int val = 0, pos = -1; map<int, int> used; for(int i = 0; i < n; i++) { if(gondolaSeq[i] <= n) { val = gondolaSeq[i]; pos = i; break; } } vector<pair<int, int>> vec; for (int i = 0; i < n; i++) { if (gondolaSeq[i] > n) { vec.push_back({gondolaSeq[i], i}); } } if(pos != -1) { for (int i = pos; i < n; i++) { gondolaSeq[i] = val++; if (val > n) { val = 1; } } for (int i = 0; i < pos; i++) { gondolaSeq[i] = val++; if (val > n) { val = 1; } } } else { for (int i = 0; i < n; i++) { gondolaSeq[i] = i + 1; } } sort(vec.begin(), vec.end()); int cur = n + 1, it = 0; for (int i = 0; i < vec.size(); i++) { while (cur <= vec[i].first) { replacementSeq[it++] = gondolaSeq[vec[i].second]; gondolaSeq[vec[i].second] = cur++; } } return it; } int countReplacement(int n, int inputSeq[]) { return -3; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 268 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 3 ms | 588 KB | Output is correct |
7 | Correct | 8 ms | 952 KB | Output is correct |
8 | Correct | 7 ms | 844 KB | Output is correct |
9 | Correct | 2 ms | 460 KB | Output is correct |
10 | Correct | 8 ms | 844 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 4 ms | 588 KB | Output is correct |
7 | Correct | 9 ms | 972 KB | Output is correct |
8 | Correct | 7 ms | 844 KB | Output is correct |
9 | Correct | 4 ms | 460 KB | Output is correct |
10 | Correct | 8 ms | 844 KB | Output is correct |
11 | Incorrect | 1 ms | 204 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 2 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 8 ms | 960 KB | Output is correct |
12 | Correct | 11 ms | 1104 KB | Output is correct |
13 | Correct | 13 ms | 1460 KB | Output is correct |
14 | Correct | 7 ms | 976 KB | Output is correct |
15 | Correct | 26 ms | 2284 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |