Submission #773515

#TimeUsernameProblemLanguageResultExecution timeMemory
773515vjudge1Zagrade (COI20_zagrade)C++17
100 / 100
859 ms1200 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lo; #define fi first #define se second #define endl "\n" #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(int i=1;i<=n;i++) #define mid ((start+end)/2) #define ort ((bas+son)/2) const lo inf = 1000000000; const lo li = 500005; const lo mod = 1000000007; int n,m,a[li],k,flag,t; int cev; string s; vector<int> v; char b[li]; inline int in(){ int x; cin>>x; return x; } int main(void){ scanf("%d %d",&n,&t); FOR b[i]='_'; stack<int> st; st.push(1); for(int i=1;i<n;i++){ if(st.size()==0){st.push(i+1);continue;} printf("? %d %d\n",st.top(),i+1); fflush(stdout); scanf("%d",&a[i]); //~ cout<<st.top()<<" :: "<<i+1<<endl; if(a[i]==1){b[st.top()]='(';b[i+1]=')';st.pop();} else st.push(i+1); } int emp=0; FOR{ if(b[i]=='_'){ emp++; } } int tmp=0; FOR{ if(b[i]=='_' && tmp<emp/2){tmp++;b[i]=')';} else if(b[i]=='_') b[i]='('; } printf("! "); FOR printf("%c",b[i]); printf("\n"); fflush(stdout); return 0; }

Compilation message (stderr)

zagrade.cpp: In function 'int main()':
zagrade.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |  scanf("%d %d",&n,&t);
      |  ~~~~~^~~~~~~~~~~~~~~
zagrade.cpp:41:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |   scanf("%d",&a[i]);
      |   ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...