Submission #1004075

# Submission time Handle Problem Language Result Execution time Memory
1004075 2024-06-21T04:37:22 Z vjudge1 Zagrade (COI20_zagrade) C++17
71 / 100
576 ms 1232 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+=')';
			st.pop_back();
		}
		else{
			s+='(';
			st.push_back(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 1 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 6 ms 600 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
8 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 267 ms 1048 KB Output is correct
3 Correct 576 ms 1064 KB Output is correct
4 Correct 572 ms 960 KB Output is correct
5 Correct 562 ms 1212 KB Output is correct
6 Correct 538 ms 1040 KB Output is correct
7 Correct 538 ms 1232 KB Output is correct
8 Correct 572 ms 872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -