# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1065664 | 2024-08-19T10:37:45 Z | andrei_iorgulescu | Gondola (IOI14_gondola) | C++14 | 25 ms | 10840 KB |
#include <bits/stdc++.h> #include "gondola.h" #warning That's not FB, that's my FB using namespace std; int valid(int n, int inputSeq[]) { for (int i = 0; i < n; i++) inputSeq[i]--; int shift = -1; set<int> ele; for (int i = 0; i < n; i++) ele.insert(inputSeq[i]); if (ele.size() != n) return 0; for (int i = 0; i < n; i++) { if (inputSeq[i] < n) { int cur_shift = (n + inputSeq[i] - i) % n; if (shift == -1) shift = cur_shift; else if (shift != cur_shift) return 0; } } return 1; } int replacement(int n, int gondolaSequence[], int replacementSeq[]) { for (int i = 0; i < n; i++) gondolaSequence[i]--; int mxe = 0; for (int i = 0; i < n; i++) mxe = max(mxe, gondolaSequence[i]); vector<int> pos(mxe + 5), ans(mxe + 5); for (int i = 0; i <= mxe; i++) pos[i] = -1; for (int i = 0; i < n; i++) pos[gondolaSequence[i]] = i; set<int> spatii; for (int i = mxe; i >= 0; i--) { if (pos[i] == -1) ans[i] = *spatii.begin(); else ans[i] = pos[i], spatii.insert(pos[i]); } int shift = 0; for (int i = 0; i < n; i++) { if (gondolaSequence[i] < n) { shift = (n + gondolaSequence[i] - i) % n; } } vector<vector<int>> lol(n); for (int i = 0; i < n; i++) lol[i].push_back((i + shift) % n); for (int i = n; i <= mxe; i++) lol[ans[i]].push_back(i); vector<int> cur(n); for (int i = n; i <= mxe; i++) { replacementSeq[i - n] = lol[ans[i]][cur[ans[i]]]; cur[ans[i]]++; } for (int i = 0; i <= mxe - n; i++) replacementSeq[i]++; return mxe - n + 1; } int countReplacement(int n, int inputSeq[]) { return -1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 7 ms | 2272 KB | Output is correct |
7 | Correct | 19 ms | 3676 KB | Output is correct |
8 | Correct | 14 ms | 3844 KB | Output is correct |
9 | Correct | 4 ms | 1372 KB | Output is correct |
10 | Correct | 18 ms | 4444 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 8 ms | 2140 KB | Output is correct |
7 | Correct | 20 ms | 3720 KB | Output is correct |
8 | Correct | 14 ms | 3928 KB | Output is correct |
9 | Correct | 4 ms | 1372 KB | Output is correct |
10 | Correct | 18 ms | 4444 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 440 KB | Output is correct |
13 | Correct | 12 ms | 2396 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 25 ms | 5324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 356 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 600 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 352 KB | Output is correct |
11 | Correct | 19 ms | 9704 KB | Output is correct |
12 | Correct | 23 ms | 10840 KB | Output is correct |
13 | Correct | 19 ms | 5596 KB | Output is correct |
14 | Correct | 19 ms | 9560 KB | Output is correct |
15 | Correct | 17 ms | 5072 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Integer -1 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Integer -1 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Integer -1 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Integer -1 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |