# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1064369 | 2024-08-18T11:56:25 Z | anango | Gondola (IOI14_gondola) | C++17 | 42 ms | 6616 KB |
#include "gondola.h" #include <bits/stdc++.h> using namespace std; int valid(int n, int inputSeq[]) { vector<int> pos(n,-1); set<int> seen; for (int i=0; i<n; i++) { if (inputSeq[i]<=n) { pos[inputSeq[i]-1] = i; } if (seen.count(inputSeq[i]-1)) { return 0; } seen.insert(inputSeq[i]-1); } set<int> S; for (int i=0; i<n; i++) { if (pos[i]!=-1) { S.insert((pos[i]-i+n)%n); } } return S.size()<=1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { vector<pair<int,int>> posindex; vector<int> actual(n,-1); for (int i=0; i<n; i++) { if (gondolaSeq[i]<=n) { for (int j=0; j<n; j++) { actual[j] = (gondolaSeq[i]-1+j-i+3*n)%n; } break; } } for (int i=0; i<n; i++) { //cout << actual[i] <<" "; } //cout << endl; for (int i=0; i<n; i++) { posindex.push_back({gondolaSeq[i]-1,i}); } sort(posindex.begin(), posindex.end()); vector<int> repl; int cur = n; for (int i=0; i<posindex.size(); i++) { while (posindex[i].first>=cur) { repl.push_back(actual[posindex[i].second]); cur++; actual[posindex[i].second] = cur; } } for (int i=0; i<repl.size(); i++) { replacementSeq[i] = repl[i]+1; } //cout << "done " << repl.size() << endl; return repl.size(); } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 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 | 1 ms | 348 KB | Output is correct |
# | 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 | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 10 ms | 2364 KB | Output is correct |
7 | Correct | 6 ms | 1116 KB | Output is correct |
8 | Correct | 23 ms | 4188 KB | Output is correct |
9 | Correct | 6 ms | 1628 KB | Output is correct |
10 | Correct | 25 ms | 4936 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 428 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 10 ms | 2396 KB | Output is correct |
7 | Correct | 7 ms | 1016 KB | Output is correct |
8 | Correct | 20 ms | 4188 KB | Output is correct |
9 | Correct | 7 ms | 1624 KB | Output is correct |
10 | Correct | 26 ms | 4848 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 12 ms | 2140 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 42 ms | 6616 KB | Output is correct |
# | 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 | 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 | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Integer 7 violates the range [1, 6] |
7 | Halted | 0 ms | 0 KB | - |
# | 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 | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Integer 7 violates the range [1, 6] |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |