Submission #780784

#TimeUsernameProblemLanguageResultExecution timeMemory
780784devariaotaZagrade (COI20_zagrade)C++17
0 / 100
1 ms296 KiB
#include <bits/stdc++.h> #define LL long long using namespace std; LL jawab; void tanya(LL x,LL y) { cout<<">>> ? "<<x<<" "<<y<<endl; cin>>jawab; } int main() { LL n,q; scanf("%lld %lld",&n,&q); vector<LL>v; char arr[n+5]; for(LL a=1;a<=n;a++) { arr[a]='*'; } LL buka=0,tutup=0; for(LL a=1;a<=n;a++) { if(v.size()==0) { v.push_back(a); continue; } tanya(v[v.size()-1],a); if(!jawab) { v.push_back(a); } else { arr[v[v.size()-1]]='('; arr[a]=')'; tutup++; v.pop_back(); } } LL bagi=n/2; for(LL a=1;a<=n;a++) { // printf("%lld %lld %lld\n",buka,tutup,bagi); if(arr[a]=='*') { if(tutup<bagi) { arr[a]=')'; tutup++; } else arr[a]='('; } } cout<<">>> ! "; for(LL a=1;a<=n;a++)cout<<arr[a]<<" "; cout<<endl; }

Compilation message (stderr)

zagrade.cpp: In function 'int main()':
zagrade.cpp:20:6: warning: unused variable 'buka' [-Wunused-variable]
   20 |   LL buka=0,tutup=0;
      |      ^~~~
zagrade.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%lld %lld",&n,&q);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...