# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
132218 | 2019-07-18T13:35:43 Z | miguel | 곤돌라 (IOI14_gondola) | C++14 | 15 ms | 2040 KB |
#include<bits/stdc++.h> #include<gondola.h> using namespace std; #define rc(x) return cout<<x<<endl,0 #define pb push_back #define dbg(x) cout << #x << '=' << x << '\n'; #define ll long long #define sz size() #define x first #define y second #define pi pair <int, int> #define pii pair <int, pi> #define vi vector <int> const ll mod = 998244353; int n; int nxt(int lol, int n){ if(lol<n-1) return lol+1; else return 0; } int nxtg(int lol, int n){ if(lol==n) return 1; else return (lol+1); } int valid(int n, int v[]){ int cnt[250001]; memset(cnt, 0, sizeof cnt); int mn=250001, mx=0, br=0, idx; for(int i=0; i<n; i++){ if(mn>v[i]){ mn=v[i]; idx=i; } mx=max(mx, v[i]); } int xd=idx; if(v[xd]<=n && v[xd]!=mn+((xd-idx+n)%n)) return 0; cnt[v[xd]]++; xd=nxt(xd, n); while(xd!=idx){ if(v[xd]<=n && v[xd]!=mn+((xd-idx+n)%n)) return 0; cnt[v[xd]]++; xd=nxt(xd, n); } for(int i=1; i<=n; i++){ if(cnt[i]>1) return 0; } for(int i=n+1; i<=mx; i++){ if(cnt[i]!=1) return 0; } return 1; } int replacement(int n, int v[], int s[]){ int mn=n+1, mx=0, idx=0; vi cnt; int id[250001]; cnt.pb(n); for(int i=0; i<n; i++){ if(v[i]>n){ cnt.pb(v[i]); id[v[i]]=i; } if(mn>v[i]){ mn=v[i]; idx=i; } mx=max(mx, v[i]); } sort(cnt.begin(), cnt.end()); //dbg(mn) dbg(idx); //cout<<cnt[0]<<" "; for(int i=1; i<cnt.size(); i++){ //cout<<cnt[i]<<" "; int lst=cnt[i-1], cur=cnt[i]; lst++; s[lst-(n+1)]=(mn+(id[cur]-idx+n)%n)%n+(((mn+(id[cur]-idx+n)%n)%n)==0); while(lst<cur){ lst++; s[lst-(n+1)]=lst-1; } } //cout<<endl; //cout<<mx-n<<endl; //for(int i=0; i<(mx-n); i++) cout<<s[i]<<" "; return mx-n; } int countReplacement( int n, int num[] ) {return 0;}
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1272 KB | Output is correct |
2 | Correct | 3 ms | 1144 KB | Output is correct |
3 | Correct | 3 ms | 1272 KB | Output is correct |
4 | Correct | 3 ms | 1272 KB | Output is correct |
5 | Correct | 3 ms | 1272 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1276 KB | Output is correct |
2 | Correct | 3 ms | 1272 KB | Output is correct |
3 | Correct | 3 ms | 1272 KB | Output is correct |
4 | Correct | 3 ms | 1272 KB | Output is correct |
5 | Correct | 3 ms | 1272 KB | Output is correct |
6 | Correct | 8 ms | 1656 KB | Output is correct |
7 | Correct | 14 ms | 2040 KB | Output is correct |
8 | Correct | 12 ms | 1784 KB | Output is correct |
9 | Correct | 9 ms | 1528 KB | Output is correct |
10 | Correct | 13 ms | 2040 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1272 KB | Output is correct |
2 | Correct | 3 ms | 1272 KB | Output is correct |
3 | Correct | 3 ms | 1272 KB | Output is correct |
4 | Correct | 3 ms | 1272 KB | Output is correct |
5 | Correct | 3 ms | 1272 KB | Output is correct |
6 | Correct | 8 ms | 1656 KB | Output is correct |
7 | Correct | 14 ms | 2040 KB | Output is correct |
8 | Correct | 12 ms | 1784 KB | Output is correct |
9 | Correct | 6 ms | 1528 KB | Output is correct |
10 | Correct | 15 ms | 1912 KB | Output is correct |
11 | Correct | 3 ms | 1272 KB | Output is correct |
12 | Correct | 3 ms | 1400 KB | Output is correct |
13 | Correct | 9 ms | 1656 KB | Output is correct |
14 | Correct | 3 ms | 1272 KB | Output is correct |
15 | Correct | 15 ms | 2040 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 400 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Incorrect | 2 ms | 376 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Incorrect | 2 ms | 256 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |