# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
832437 | 2023-08-21T10:20:46 Z | ttamx | 곤돌라 (IOI14_gondola) | C++14 | 34 ms | 4944 KB |
#include "gondola.h" #include<bits/stdc++.h> using namespace std; int valid(int n, int Seq[]){ vector<int> s(n); map<int,bool> mp; for(int i=0;i<n;i++){ if(mp[Seq[i]])return 0; mp[Seq[i]]=true; if(Seq[i]<=n)s[i]=Seq[i]; } for(int t=0;t<2;t++){ for(int i=0;i<n;i++){ if(s[i]>0){ auto &x=s[(i+1)%n]; int val=s[i]%n+1; if(x==0)x=val; else if(x!=val)return 0; } } } return 1; } //---------------------- int replacement(int n, int Seq[], int Ans[]){ vector<int> s(n); vector<pair<int,int>> vec; for(int i=0;i<n;i++){ if(Seq[i]<=n)s[i]=Seq[i]; else vec.emplace_back(Seq[i],i); } for(int t=0;t<2;t++)for(int i=0;i<n;i++)if(s[i]>0)s[(i+1)%n]=s[i]%n+1; if(s[0]==0)iota(s.begin(),s.end(),1); sort(vec.begin(),vec.end()); int nxt=n+1; int sz=0; for(auto [num,pos]:vec){ while(s[pos]!=num){ Ans[sz++]=s[pos]; s[pos]=nxt++; } } return sz; } //---------------------- int countReplacement(int n, int inputSeq[]){ return -3; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 244 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 13 ms | 2304 KB | Output is correct |
7 | Correct | 6 ms | 940 KB | Output is correct |
8 | Correct | 21 ms | 4188 KB | Output is correct |
9 | Correct | 6 ms | 1560 KB | Output is correct |
10 | Correct | 27 ms | 4820 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 11 ms | 2260 KB | Output is correct |
7 | Correct | 6 ms | 980 KB | Output is correct |
8 | Correct | 25 ms | 4216 KB | Output is correct |
9 | Correct | 7 ms | 1492 KB | Output is correct |
10 | Correct | 25 ms | 4792 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 13 ms | 2132 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 34 ms | 4944 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 312 KB | Output is correct |
10 | Correct | 1 ms | 308 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 9 ms | 1392 KB | Output is correct |
12 | Correct | 8 ms | 1448 KB | Output is correct |
13 | Correct | 11 ms | 1500 KB | Output is correct |
14 | Correct | 7 ms | 1364 KB | Output is correct |
15 | Correct | 16 ms | 2388 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Integer -3 violates the range [0, 1000000008] |
2 | Halted | 0 ms | 0 KB | - |