# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1034704 | 2024-07-25T16:54:31 Z | ArthuroWich | 곤돌라 (IOI14_gondola) | C++17 | 26 ms | 5880 KB |
#include "gondola.h" #include <bits/stdc++.h> using namespace std; int valid(int n, int gondolaSeq[]) { int mi = INT_MAX, ind = -1; set<int> c; for (int i = 0; i < n; i++) { c.insert(gondolaSeq[i]); if (mi > gondolaSeq[i]) { mi = gondolaSeq[i]; ind = i; } } if (c.size() < n) { return 0; } if (mi > n) { return 1; } ind -= (mi-1); ind += n; ind %= n; vector<int> a; for (int i = ind; i < n; i++) { a.push_back(gondolaSeq[i]); } for (int i = 0; i < ind; i++) { a.push_back(gondolaSeq[i]); } for (int i = 0; i < n; i++) { if (a[i] <= n && a[i] != i+1) { return 0; } } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { int mi = INT_MAX, ind = -1, ma = 0; set<int> c; for (int i = 0; i < n; i++) { ma = max(ma, gondolaSeq[i]); c.insert(gondolaSeq[i]); if (mi > gondolaSeq[i]) { mi = gondolaSeq[i]; ind = i; } } vector<pair<int, int>> num; if (ma <= n) { return 0; } if (mi > n) { for (int i = 0; i < n; i++) { num.push_back({gondolaSeq[i], i+1}); } int l = 0; sort(num.begin(), num.end()); l = num.back().first-n; for (int i = 0; i < l; i++) { replacementSeq[i] = num.back().second; } for (int i = 0; i < num.size(); i++) { replacementSeq[num[i].first-n-1] = num[i].second; } return l; } else { ind -= (mi-1); ind += n; ind %= n; vector<int> a; for (int i = ind; i < n; i++) { a.push_back(gondolaSeq[i]); } for (int i = 0; i < ind; i++) { a.push_back(gondolaSeq[i]); } for (int i = 0; i < n; i++) { if (a[i] > n) { num.push_back({a[i], i+1}); } } int l = 0; sort(num.begin(), num.end()); l = num.back().first-n; for (int i = 0; i < l; i++) { replacementSeq[i] = num.back().second; } for (int i = 0; i < num.size(); i++) { replacementSeq[num[i].first-n-1] = num[i].second; } return l; } } int countReplacement(int n, int gondolaSeq[]) { return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 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 |
# | 결과 | 실행 시간 | 메모리 | 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 | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 8 ms | 2904 KB | Output is correct |
7 | Correct | 18 ms | 4208 KB | Output is correct |
8 | Correct | 15 ms | 5080 KB | Output is correct |
9 | Correct | 5 ms | 1868 KB | Output is correct |
10 | Correct | 18 ms | 5592 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 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 | 1 ms | 344 KB | Output is correct |
6 | Correct | 7 ms | 2908 KB | Output is correct |
7 | Correct | 20 ms | 4188 KB | Output is correct |
8 | Correct | 14 ms | 5080 KB | Output is correct |
9 | Correct | 5 ms | 1884 KB | Output is correct |
10 | Correct | 19 ms | 5620 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 10 ms | 2868 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 26 ms | 5880 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 | 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 600 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 | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 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 | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |