# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
58606 | 2018-07-18T12:12:17 Z | RezwanArefin01 | Gondola (IOI14_gondola) | C++17 | 82 ms | 4916 KB |
#include <bits/stdc++.h> #include "gondola.h" using namespace std; int valid(int n, int a[]) { int X, idx = -1; for(int i = 0; i < n; i++) { if(a[i] >= 1 && a[i] <= n) { X = a[i], idx = i; } } set<int> st(a, a + n); if(st.size() != n) return 0; if(idx == -1) return 1; for(int i = 0; i < n; i++) { if(a[i] >= 1 && a[i] <= n) { if((X + i - idx + n) % n != a[i] % n) return 0; } } return 1; } //---------------------- int replacement(int n, int a[], int res[]) { int l = 0, idx = -1, X; for(int i = 0; i < n; i++) { if(1 <= a[i] && a[i] <= n) idx = i, X = a[i]; } int b[n]; if(idx == -1) { for(int i = 0; i < n; i++) b[i] = i + 1; } else { for(int i = 0; i < n; i++) { b[i] = (X + i - idx + n) % n; if(b[i] == 0) b[i] = n; } } vector<pair<int, int> > v; for(int i = 0; i < n; i++) { if(a[i] > n) { v.emplace_back(a[i], b[i]); } } sort(v.begin(), v.end()); for(int i = 0; i < v.size(); i++) { while(l + n < v[i].first) { res[l++] = v[i].second; v[i].second = l + n; } } return l; } //---------------------- int countReplacement(int n, int inputSeq[]) { }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 428 KB | Output is correct |
4 | Correct | 2 ms | 476 KB | Output is correct |
5 | Correct | 2 ms | 476 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 476 KB | Output is correct |
2 | Correct | 2 ms | 608 KB | Output is correct |
3 | Correct | 2 ms | 608 KB | Output is correct |
4 | Correct | 2 ms | 608 KB | Output is correct |
5 | Correct | 2 ms | 608 KB | Output is correct |
6 | Correct | 12 ms | 2320 KB | Output is correct |
7 | Correct | 46 ms | 3876 KB | Output is correct |
8 | Correct | 33 ms | 4304 KB | Output is correct |
9 | Correct | 9 ms | 4304 KB | Output is correct |
10 | Correct | 30 ms | 4816 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4816 KB | Output is correct |
2 | Correct | 2 ms | 4816 KB | Output is correct |
3 | Correct | 2 ms | 4816 KB | Output is correct |
4 | Correct | 3 ms | 4816 KB | Output is correct |
5 | Correct | 2 ms | 4816 KB | Output is correct |
6 | Correct | 19 ms | 4816 KB | Output is correct |
7 | Correct | 53 ms | 4816 KB | Output is correct |
8 | Correct | 28 ms | 4816 KB | Output is correct |
9 | Correct | 9 ms | 4816 KB | Output is correct |
10 | Correct | 28 ms | 4844 KB | Output is correct |
11 | Correct | 2 ms | 4844 KB | Output is correct |
12 | Correct | 4 ms | 4844 KB | Output is correct |
13 | Correct | 35 ms | 4844 KB | Output is correct |
14 | Correct | 3 ms | 4844 KB | Output is correct |
15 | Correct | 82 ms | 4916 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4916 KB | Output is correct |
2 | Correct | 2 ms | 4916 KB | Output is correct |
3 | Correct | 3 ms | 4916 KB | Output is correct |
4 | Correct | 2 ms | 4916 KB | Output is correct |
5 | Correct | 3 ms | 4916 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4916 KB | Output is correct |
2 | Correct | 3 ms | 4916 KB | Output is correct |
3 | Correct | 2 ms | 4916 KB | Output is correct |
4 | Correct | 2 ms | 4916 KB | Output is correct |
5 | Correct | 2 ms | 4916 KB | Output is correct |
6 | Correct | 2 ms | 4916 KB | Output is correct |
7 | Correct | 3 ms | 4916 KB | Output is correct |
8 | Correct | 2 ms | 4916 KB | Output is correct |
9 | Correct | 2 ms | 4916 KB | Output is correct |
10 | Correct | 3 ms | 4916 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4916 KB | Output is correct |
2 | Correct | 2 ms | 4916 KB | Output is correct |
3 | Correct | 2 ms | 4916 KB | Output is correct |
4 | Correct | 2 ms | 4916 KB | Output is correct |
5 | Correct | 2 ms | 4916 KB | Output is correct |
6 | Correct | 2 ms | 4916 KB | Output is correct |
7 | Correct | 2 ms | 4916 KB | Output is correct |
8 | Correct | 5 ms | 4916 KB | Output is correct |
9 | Correct | 3 ms | 4916 KB | Output is correct |
10 | Correct | 5 ms | 4916 KB | Output is correct |
11 | Correct | 22 ms | 4916 KB | Output is correct |
12 | Correct | 20 ms | 4916 KB | Output is correct |
13 | Correct | 32 ms | 4916 KB | Output is correct |
14 | Correct | 23 ms | 4916 KB | Output is correct |
15 | Correct | 23 ms | 4916 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 4916 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 4916 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 4916 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 4916 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |