# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1026860 | 2024-07-18T12:26:37 Z | MarwenElarbi | 곤돌라 (IOI14_gondola) | C++17 | 44 ms | 4940 KB |
#include <bits/stdc++.h> #include "gondola.h" using namespace std; #define pb push_back #define se second #define fi first const int nax=5e5+5; const int MOD=1e9+7; vector<pair<int,int>> tab; int valid(int n, int inputSeq[]) { set<int> st; for (int i = 0; i < n; ++i) { st.insert(i+1); } bool test=true; bool nabba=false; for (int i = 0; i < n; ++i) { if(inputSeq[i]<=n){ st.erase(inputSeq[i]); } } for (int i = 0; i < n; ++i) { if(inputSeq[i]<=n){ int cnt=inputSeq[i]-1; for (int j = i-1; j >= 0 && inputSeq[j]>n ; --j) { if(cnt==0) cnt=n; if(!st.count(cnt)){ test=false; } st.erase(cnt); inputSeq[j]=cnt; cnt--; } } } if(st.size()){ int m=st.size(); for (int i = n-m; i < n; ++i) { inputSeq[i]=*st.begin(); st.erase(*st.begin()); } } for (int i = 0; i < n-1; ++i) { if(inputSeq[i]<inputSeq[i+1]&&inputSeq[i+1]-inputSeq[i]>1) test=false; if(inputSeq[i]>inputSeq[i+1]&&(inputSeq[i]!=n||inputSeq[i+1]!=1)){ test=false; } } set<int> stt; for (int i = 0; i < n; ++i) { stt.insert(inputSeq[i]); } test&=(stt.size()==n); return test; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 |
# | 결과 | 실행 시간 | 메모리 | 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 | 13 ms | 2140 KB | Output is correct |
7 | Correct | 44 ms | 4940 KB | Output is correct |
8 | Correct | 29 ms | 3932 KB | Output is correct |
9 | Correct | 7 ms | 1372 KB | Output is correct |
10 | Correct | 31 ms | 4444 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 | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 13 ms | 2136 KB | Output is correct |
7 | Correct | 44 ms | 4700 KB | Output is correct |
8 | Correct | 24 ms | 3928 KB | Output is correct |
9 | Correct | 7 ms | 1372 KB | Output is correct |
10 | Correct | 31 ms | 4596 KB | Output is correct |
11 | Incorrect | 0 ms | 344 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Integer -2 violates the range [0, 350000] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Integer -2 violates the range [0, 350000] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Integer -2 violates the range [0, 350000] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |