# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
463775 | 2021-08-11T17:57:09 Z | mosiashvililuka | Secret Permutation (RMI19_permutation) | C++14 | 2743 ms | 200 KB |
#include<bits/stdc++.h> #include "permutationc.h" using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,p[1009],pi,ONE,LAST; vector <int> v,vv,ans; void solve(int N); int query(std::vector<int> V); void answer(std::vector<int> P); void Fill(vector <int>& q){ int FX[280]; for(int h=0; h<=a+1; h++){ FX[h]=0; } for(int h=0; h<q.size(); h++){ FX[q[h]]=1; } for(int h=1; h<=a; h++){ if(FX[h]==0){ q.push_back(h); } } } void solve(int N){ a=N; for(i=1; i<=a; i++){ v.clear();pi=0; for(j=1; j<=a; j++){ if(i==j) continue; pi++;p[pi]=j; } jj=1; for(j=2; j<=pi; j++){ v.clear(); v.push_back(p[j]);v.push_back(p[jj]);v.push_back(i); Fill(v); zx=query(v); v.clear(); v.push_back(p[jj]);v.push_back(p[j]);v.push_back(i); Fill(v); xc=query(v); if(xc>zx){ jj=j; } } e=0; for(j=1; j<=pi; j++){ if(j==jj) continue; v.clear(); v.push_back(p[j]);v.push_back(p[jj]);v.push_back(i); Fill(v); zx=query(v); v.clear(); v.push_back(p[jj]);v.push_back(p[j]);v.push_back(i); Fill(v); xc=query(v); //cout<<zx<<" k "<<xc<<endl; if(zx-xc>e){ e=zx-xc; } } if(e==a-2){ ONE=i; LAST=p[jj]; break; } } //cout<<"ONE: "<<ONE<<endl; // if(a==3){ v.clear();v.push_back(ONE);Fill(v); zx=query(v); /*v.clear();v.push_back(ONE);AntiFill(v); xc=query(v);*/ if(zx==2){ vv.clear();vv.resize(3);vv[ONE-1]=1;vv[v[1]-1]=2;vv[v[2]-1]=3; }else{ vv.clear();vv.resize(3);vv[ONE-1]=1;vv[v[2]-1]=2;vv[v[1]-1]=3; } answer(vv); return; } /* for(i=1; i<=a; i++){ if(i==ONE) continue; v.clear();pi=0; for(j=1; j<=a; j++){ if(i==j) continue; if(j==ONE) continue; pi++;p[pi]=j; } jj=1; for(j=2; j<=pi; j++){ v.clear(); v.push_back(p[j]);v.push_back(p[jj]);v.push_back(i); Fill(v); zx=query(v); v.clear(); v.push_back(p[jj]);v.push_back(p[j]);v.push_back(i); Fill(v); xc=query(v); if(xc>zx){ jj=j; } } e=0; for(j=1; j<=pi; j++){ if(j==jj) continue; v.clear(); v.push_back(p[j]);v.push_back(p[jj]);v.push_back(i); Fill(v); zx=query(v); v.clear(); v.push_back(p[jj]);v.push_back(p[j]);v.push_back(i); Fill(v); xc=query(v); if(zx-xc>e){ e=zx-xc; } } if(e==a-3){ LAST=i; break; } }*/ //cout<<"LAST: "<<LAST<<endl; ans.resize(a); vv.clear();vv.push_back(ONE);vv.push_back(LAST);Fill(vv); for(i=2; i<a; i++){ v.clear();v.push_back(ONE);v.push_back(LAST);v.push_back(vv[i]);Fill(v); zx=query(v); v.clear();v.push_back(LAST);v.push_back(ONE);v.push_back(vv[i]);Fill(v); xc=query(v); c=(a+1)-(zx-xc);c/=2; ans[vv[i]-1]=c; } ans[ONE-1]=1;ans[LAST-1]=a; answer(ans); } // /*int FA[1009]; int query(vector <int> V){ int qw=0; for(int h=1; h<V.size(); h++){ qw+=abs(FA[V[h]]-FA[V[h-1]]); } return qw; } void answer(vector <int> P){ for(int h=0; h<P.size(); h++){ cout<<P[h]<<" "; } } int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>a; for(i=1; i<=a; i++){ cin>>c; FA[i]=c; } solve(a); return 0; }*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 2 ms | 200 KB | Partially correct |
2 | Partially correct | 1 ms | 200 KB | Partially correct |
3 | Partially correct | 2 ms | 200 KB | Partially correct |
4 | Partially correct | 1 ms | 200 KB | Partially correct |
5 | Partially correct | 1 ms | 200 KB | Partially correct |
6 | Partially correct | 1 ms | 200 KB | Partially correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 2 ms | 200 KB | Partially correct |
2 | Partially correct | 1 ms | 200 KB | Partially correct |
3 | Partially correct | 2 ms | 200 KB | Partially correct |
4 | Partially correct | 1 ms | 200 KB | Partially correct |
5 | Partially correct | 1 ms | 200 KB | Partially correct |
6 | Partially correct | 1 ms | 200 KB | Partially correct |
7 | Partially correct | 10 ms | 200 KB | Partially correct |
8 | Partially correct | 131 ms | 200 KB | Partially correct |
9 | Partially correct | 96 ms | 200 KB | Partially correct |
10 | Partially correct | 90 ms | 200 KB | Partially correct |
11 | Partially correct | 67 ms | 200 KB | Partially correct |
12 | Partially correct | 31 ms | 200 KB | Partially correct |
13 | Partially correct | 45 ms | 200 KB | Partially correct |
14 | Partially correct | 14 ms | 200 KB | Partially correct |
15 | Partially correct | 87 ms | 200 KB | Partially correct |
16 | Partially correct | 54 ms | 200 KB | Partially correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 2 ms | 200 KB | Partially correct |
2 | Partially correct | 1 ms | 200 KB | Partially correct |
3 | Partially correct | 2 ms | 200 KB | Partially correct |
4 | Partially correct | 1 ms | 200 KB | Partially correct |
5 | Partially correct | 1 ms | 200 KB | Partially correct |
6 | Partially correct | 1 ms | 200 KB | Partially correct |
7 | Partially correct | 10 ms | 200 KB | Partially correct |
8 | Partially correct | 131 ms | 200 KB | Partially correct |
9 | Partially correct | 96 ms | 200 KB | Partially correct |
10 | Partially correct | 90 ms | 200 KB | Partially correct |
11 | Partially correct | 67 ms | 200 KB | Partially correct |
12 | Partially correct | 31 ms | 200 KB | Partially correct |
13 | Partially correct | 45 ms | 200 KB | Partially correct |
14 | Partially correct | 14 ms | 200 KB | Partially correct |
15 | Partially correct | 87 ms | 200 KB | Partially correct |
16 | Partially correct | 54 ms | 200 KB | Partially correct |
17 | Partially correct | 874 ms | 200 KB | Partially correct |
18 | Partially correct | 1639 ms | 200 KB | Partially correct |
19 | Execution timed out | 2743 ms | 200 KB | Time limit exceeded (wall clock) |
20 | Halted | 0 ms | 0 KB | - |