# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
236950 | 2020-06-04T05:56:01 Z | crossing0ver | 곤돌라 (IOI14_gondola) | C++17 | 1000 ms | 5240 KB |
#include<bits/stdc++.h> #include "gondola.h" using namespace std; const int MAXN = 1E5+5; int n,a[MAXN]; int valid(int n1, int inputSeq[]) { n = n1; int pos = -1; for (int i = 0; i < n; i++) { a[i] = inputSeq[i]; if (a[i] <= n) pos = i; } if (pos != -1) { int x = (a[pos] - pos - 1)%n; if (x <0) x+= n; int b[MAXN]; for (int i = 0; i < n; i++) { b[(x + i)%n] = a[i]; } for (int i = 0;i < n; i++) a[i] = b[i]; } set<int> s; for (int i = 0; i < n; i++) { if (a[i] < n) { if (a[i] != i + 1) return 0; } s.insert(a[i]); } if (s.size() != n) return 0; return 1; } int replacement(int n1, int gondolaSeq[], int replacementSeq[]){ bool c = valid(n1,gondolaSeq); vector<int> v; for (int i = 0; i < n ;i++) { if (a[i] > n) { v.push_back(a[i]); } } sort (v.begin(),v.end()); int last = n; vector<int> b(n+1); vector<int> g; for (int i = 0; i < n; i++) if (a[i] <= n) b[a[i]] = 1; for (int i = 1; i <= n; i++) { if (!b[i]) g.push_back(i); } int cnt = 0; int val = n+1; vector<bool> good(1e6); for (int i = 0; i < v.size(); i++) good [v[i]] = 1; if (v.size() == 0) return 0; int mx = v.back() + 1; while (val <= mx) for (int i = 0; val <= mx && i < g.size(); i++) { if (!good[ g[i] ]) { replacementSeq[cnt] = g[i]; g[i] = val; val++; cnt++; } } return cnt; } int countReplacement(int n, int inputSeq[]) { return 0;} /* main() { int n; cin >> n; int inputseq[n]; int s[100000]; for (int i = 0;i < n; i++) cin >> inputseq[i]; cout << replacement(n,inputseq,s); } */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 16 ms | 2560 KB | Output is correct |
7 | Correct | 18 ms | 1308 KB | Output is correct |
8 | Correct | 33 ms | 4600 KB | Output is correct |
9 | Correct | 12 ms | 1664 KB | Output is correct |
10 | Correct | 32 ms | 5240 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 22 ms | 2560 KB | Output is correct |
7 | Correct | 18 ms | 1408 KB | Output is correct |
8 | Correct | 29 ms | 4608 KB | Output is correct |
9 | Correct | 11 ms | 1664 KB | Output is correct |
10 | Correct | 34 ms | 5240 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 12 ms | 768 KB | Output is correct |
14 | Correct | 4 ms | 384 KB | Output is correct |
15 | Correct | 18 ms | 1280 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1096 ms | 512 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1088 ms | 512 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1095 ms | 512 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |