# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773501 | blacktulip | Zagrade (COI20_zagrade) | C++17 | 694 ms | 856 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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]='_';
for(int i=1;i<n;i++){
printf("? %d %d\n",i,i+1);
fflush(stdout);
scanf("%d",&a[i]);
if(a[i]==1){b[i]='(';b[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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |