# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1017438 | 2024-07-09T07:59:39 Z | n3rm1n | 곤돌라 (IOI14_gondola) | C++17 | 6 ms | 1736 KB |
#include <bits/stdc++.h> #include "gondola.h" #define endl '\n' using namespace std; const int MAXN = 3e5 + 10; int seen[MAXN]; int valid(int n, int inputSeq[]) { int cnt = 0; int minim = 1e9; int minn = 1e9, maxx = 0; for (int i = 0; i < n; ++ i) { if(seen[inputSeq[i]])return 0; if(inputSeq[i] <= n)cnt ++; else { minn = min(minn, inputSeq[i]); maxx = max(maxx, inputSeq[i]); } minim = min(minim, inputSeq[i]); seen[inputSeq[i]] = 1; } int left = n - cnt; //cout << left << " " << minn << " " << maxx << endl; if(left != 0 && !(minn == n+1 && maxx == minn + left - 1)) return 0; //cout << "here " << endl; int seenit = 0, expected = minim; int onpoint = n+1; for (int i = 0; i < n; ++ i) { if(inputSeq[i] == minim) seenit = 1; if(!seenit)continue; if(inputSeq[i] > n) { expected ++; } else if(inputSeq[i] != expected) { return 0; } else expected ++; } for (int i = 0; i < n; ++ i) { if(inputSeq[i] == minim) break; if(inputSeq[i] > n) { expected ++; } else if(inputSeq[i] != expected) { return 0; } else expected ++; } return 1; } int place[MAXN]; int replacement(int n, int gondolaSeq[], int replacementSeq[]) { int len = 0; int minim = 1e9, minim_index = 0; for (int i = 0; i < n; ++ i) { place[gondolaSeq[i]] = i; if(gondolaSeq[i] > n)len ++; if(gondolaSeq[i] <= n && minim > gondolaSeq[i]) { minim = gondolaSeq[i]; minim_index = i; } } if(minim == 1e9) { for (int i = n+1; i <= 2*n; ++ i) { replacementSeq[i - n - 1] = place[i] + 1; } return len; } int expected = 1; int starter = minim_index - (minim - 1); if(starter < 0)starter += n; //cout << starter << endl; int id = 0; for (int i = starter; i < n; ++ i) { if(gondolaSeq[i] != expected && gondolaSeq[i] >= n) replacementSeq[gondolaSeq[i] - n - 1] = expected; expected ++; } for (int i = 0; i < starter; ++ i) { if(gondolaSeq[i] != expected && gondolaSeq[i] >= n) replacementSeq[gondolaSeq[i] - n - 1] = expected; expected ++; } return len; } int countReplacement(int n, int inputSeq[]) { return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 1 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 3 ms | 968 KB | Output is correct |
7 | Correct | 6 ms | 1628 KB | Output is correct |
8 | Correct | 5 ms | 1372 KB | Output is correct |
9 | Correct | 2 ms | 604 KB | Output is correct |
10 | Correct | 5 ms | 1492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 440 KB | Output is correct |
3 | Correct | 1 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 | 3 ms | 860 KB | Output is correct |
7 | Correct | 6 ms | 1424 KB | Output is correct |
8 | Correct | 5 ms | 1372 KB | Output is correct |
9 | Correct | 2 ms | 604 KB | Output is correct |
10 | Correct | 6 ms | 1372 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 3 ms | 1628 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 6 ms | 1736 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 440 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 |
# | 결과 | 실행 시간 | 메모리 | 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 | Incorrect | 0 ms | 348 KB | Integer 0 violates the range [1, 5] |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Integer 0 violates the range [1, 5] |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |