# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1001343 | 2024-06-18T22:01:44 Z | ZeroCool | Gondola (IOI14_gondola) | C++14 | 25 ms | 5144 KB |
#include "gondola.h" #include <bits/stdc++.h> using namespace std; #define ar array int valid(int n, int A[]){ int B[n]; int p; set<int> s; for(int i = 0;i < n;i++)s.insert(A[i]); if(s.size() < n)return 0; for(int i = 0;i< n;i++){ if(A[i] <= n){ p = i; B[i] = A[i]; break; } } for(int i = p + 1;i < n;i++){ B[i] = B[i-1] + 1; } for(int i = p - 1;i >= 0;i--){ B[i] = B[i + 1] - 1; } for(int i = 0;i < n;i ++){ if(B[i] > n) B[i] -= n; if(B[i] <= 0) B[i] += n; } for(int i = 0;i<n;i++){ if(A[i] > n)continue; if(A[i] != B[i])return 0; } return 1; } //---------------------- int replacement(int n, int A[], int ans[]){ int o = 0; for(int i = 0;i < n;i++){ if(A[i] > n)o++; } vector<ar<int, 2> > v; if(o == n){ for(int i = 0;i < n;i++)v.push_back({A[i], i + 1}); }else{ int B[n]; int p; for(int i = 0;i< n;i++){ if(A[i] <= n){ p = i; B[i] = A[i]; break; } } for(int i = p + 1;i < n;i++){ B[i] = B[i-1] + 1; } for(int i = p - 1;i >= 0;i--){ B[i] = B[i + 1] - 1; } for(int i = 0;i < n;i ++){ if(B[i] > n) B[i] -= n; if(B[i] <= 0) B[i] += n; } for(int i = 0;i < n;i++){ if(A[i] > n)v.push_back({A[i], B[i]}); } } sort(v.begin(), v.end()); int c = n + 1; int cnt = 0; for(auto [x, i]: v){ ans[cnt++] = i; while(c != x){ ans[cnt++] = c++; } c++; } return cnt; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 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 |
# | 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 | 7 ms | 2396 KB | Output is correct |
7 | Correct | 19 ms | 3932 KB | Output is correct |
8 | Correct | 14 ms | 4116 KB | Output is correct |
9 | Correct | 4 ms | 1628 KB | Output is correct |
10 | Correct | 18 ms | 4888 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 | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 7 ms | 2396 KB | Output is correct |
7 | Correct | 19 ms | 4072 KB | Output is correct |
8 | Correct | 13 ms | 4184 KB | Output is correct |
9 | Correct | 4 ms | 1628 KB | Output is correct |
10 | Correct | 17 ms | 4748 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 9 ms | 2368 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 25 ms | 5144 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 | 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 | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 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 | 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 | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 444 KB | Output is correct |
8 | Correct | 1 ms | 440 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 5 ms | 1372 KB | Output is correct |
12 | Correct | 6 ms | 1624 KB | Output is correct |
13 | Correct | 9 ms | 1608 KB | Output is correct |
14 | Correct | 5 ms | 1372 KB | Output is correct |
15 | Correct | 12 ms | 2360 KB | Output is correct |
# | 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 | 1 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 | 600 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 | - |