Submission #643403

#TimeUsernameProblemLanguageResultExecution timeMemory
643403kebineZagonetka (COI18_zagonetka)C++17
9 / 100
8 ms208 KiB
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); const ll MOD=1e9+7; using namespace std; ll N,a[105]; int main(){ cin>>N; for(int i=1;i<=N;i++){ cin>>a[i]; } if(N<=6){ ll p[105],minn[105],maks[105]; for(int i=1;i<=N;i++){ p[i]=i; minn[i]=a[i]; maks[i]=a[i]; } do{ cout<<"query"; for(int i=1;i<=N;i++){ cout<<' '<<p[i]; } cout<<endl; ll x; cin>>x; if(x==1){ for(int i=1;i<=N;i++){ if(p[i]<minn[i]){ // cout<<"update minn"<<endl; for(int j=1;j<=N;j++){ minn[j]=p[j]; } break; } if(p[i]>minn[i]){ break; } } for(int i=1;i<=N;i++){ if(p[i]>maks[i]){ // cout<<"update maks"<<endl; for(int j=1;j<=N;j++){ maks[j]=p[j]; } break; } if(p[i]<maks[i]){ break; } } } }while(next_permutation(p+1,p+N+1)); cout<<"end"<<endl; for(int i=1;i<=N;i++){ cout<<minn[i]<<' '; } cout<<endl; for(int i=1;i<=N;i++){ cout<<maks[i]<<' '; } cout<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...