Submission #725547

#TimeUsernameProblemLanguageResultExecution timeMemory
725547groshiCONSUL (info1cup19_consul)C++17
5.66 / 100
43 ms208 KiB
#include<bits/stdc++.h> #include "grader.h" //#define int long long using namespace std; bool bylo[2000]; map<int,int> mapka; /*void say_answer(int N) { cout<<N<<"\n"; } int kth(int x) { cout<<"ile tu "<<x<<"\n"; int co; cin>>co; return co; } int cnt(int x) { cout<<"ile tego "<<x<<"\n"; cin>>x; return x; }*/ void solve(int N) { for(int i=0;i<=N;i++) bylo[i]=0; mapka.clear(); srand(time(0)); int pytan=0; int wolne=N; while(pytan<49 && wolne) { int gdzie=rand()%N; gdzie++; if(bylo[gdzie]) continue; wolne--; bylo[gdzie]=1; int ile=kth(gdzie); if(mapka.find(ile)!=mapka.end()) continue; mapka[ile]=1; pytan++; int essa=cnt(ile); pytan++; if(essa>N/3) { say_answer(ile); return; } } say_answer(-1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...