Submission #1004083

# Submission time Handle Problem Language Result Execution time Memory
1004083 2024-06-21T04:51:23 Z vjudge1 Zagrade (COI20_zagrade) C++17
100 / 100
554 ms 1808 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
int const N=2e5+5;
int const mod=1e9+7;


int main(){
	int n,q;
	cin>>n>>q;
	int a=0;
	string s="";
	vector<int> st;
	for(int i=0;i<n;i++){
		if(st.size()==0){
			st.push_back(i);
			s+='?';
			continue;
		}
		cout<<"? "<<(st.back())+1<<' '<<i+1<<endl;
		bool bl;
		cin>>bl;
		if(bl){
			s+=')';
			s[st.back()]='(';
			st.pop_back();
		}
		else{
			s+='?';
			st.push_back(i);
		}
	}
	int sz=st.size();
	for(int i=0;i<sz;i++){
		if(i<sz/2)
			s[st[i]]=')';
		else
			s[st[i]]='(';
	}
	cout<<"! "<<s<<endl;
	return 0;
}

Compilation message

zagrade.cpp: In function 'int main()':
zagrade.cpp:12:6: warning: unused variable 'a' [-Wunused-variable]
   12 |  int a=0;
      |      ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 3 ms 432 KB Output is correct
3 Correct 6 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 444 KB Output is correct
5 Correct 5 ms 344 KB Output is correct
6 Correct 4 ms 436 KB Output is correct
7 Correct 5 ms 344 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 284 ms 856 KB Output is correct
3 Correct 503 ms 1128 KB Output is correct
4 Correct 449 ms 872 KB Output is correct
5 Correct 513 ms 800 KB Output is correct
6 Correct 493 ms 1312 KB Output is correct
7 Correct 502 ms 1728 KB Output is correct
8 Correct 554 ms 956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 492 ms 1808 KB Output is correct
3 Correct 517 ms 1092 KB Output is correct
4 Correct 507 ms 1148 KB Output is correct
5 Correct 486 ms 964 KB Output is correct
6 Correct 527 ms 1108 KB Output is correct
7 Correct 528 ms 1204 KB Output is correct
8 Correct 538 ms 988 KB Output is correct