# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
799030 | 2023-07-31T08:50:13 Z | FatihSolak | Gondola (IOI14_gondola) | C++17 | 23 ms | 5184 KB |
#include "gondola.h" #include <bits/stdc++.h> using namespace std; vector<int> get(int n,int inputSeq[]){ int pos = 0; for(int i = 0;i<n;i++){ if(inputSeq[i] <= n){ pos = (i + 1 - inputSeq[i] + n)%n; } } vector<int> ret; for(int i = pos;i < n;i++){ ret.push_back(inputSeq[i]); } for(int i = 0;i<pos;i++){ ret.push_back(inputSeq[i]); } return ret; } int valid(int n, int inputSeq[]){ vector<int> inp = get(n,inputSeq); set<int> s; for(int i = 0;i<n;i++){ s.insert(inp[i]); if(inp[i] <= n && inp[i] != i + 1){ return 0; } } if(s.size() != n) return 0; return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]){ vector<int> inp = get(n,gondolaSeq); map<int,int> mp; int maxi = 0; for(int i = 0;i<n;i++){ if(inp[i] > n){ mp[inp[i]] = i; if(inp[maxi] < inp[i]) maxi = i; } } int l = 0; int tmp = inp[maxi]; inp[maxi] = maxi + 1; for(int i = n + 1;i <= tmp;i++){ if(mp.count(i) && mp[i] != maxi){ replacementSeq[l++] = mp[i] + 1; } else{ replacementSeq[l++] = inp[maxi]; inp[maxi] = i; } } return l; } //---------------------- int countReplacement(int n, int inputSeq[]){ return -3; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 288 KB | Output is correct |
3 | Correct | 0 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 304 KB | Output is correct |
6 | Correct | 9 ms | 2492 KB | Output is correct |
7 | Correct | 7 ms | 1668 KB | Output is correct |
8 | Correct | 16 ms | 4556 KB | Output is correct |
9 | Correct | 5 ms | 1620 KB | Output is correct |
10 | Correct | 19 ms | 5184 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 308 KB | Output is correct |
6 | Correct | 8 ms | 2464 KB | Output is correct |
7 | Correct | 8 ms | 1600 KB | Output is correct |
8 | Correct | 16 ms | 4556 KB | Output is correct |
9 | Correct | 5 ms | 1620 KB | Output is correct |
10 | Correct | 19 ms | 5168 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 3 ms | 980 KB | Output is correct |
14 | Correct | 1 ms | 312 KB | Output is correct |
15 | Correct | 7 ms | 1696 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 304 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 308 KB | Output is correct |
2 | Correct | 1 ms | 308 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 304 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 8 ms | 1640 KB | Output is correct |
12 | Correct | 7 ms | 1836 KB | Output is correct |
13 | Correct | 21 ms | 2676 KB | Output is correct |
14 | Correct | 8 ms | 1692 KB | Output is correct |
15 | Correct | 23 ms | 2940 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 312 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |