답안 #1004642

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1004642 2024-06-21T11:08:15 Z leanchec Zagrade (COI20_zagrade) C++17
100 / 100
623 ms 1704 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, q;
	cin >> n >> q;
	vector<int> c;
	vector<char> resp(n);

	for(int i=1; i<=n; i++){
		if(c.empty()){
			c.push_back(i);
		}
		else{
			cout << "? " << c.back() << " " << i << endl;
			int r;
			cin >> r;
			if(r==1){
				resp[c.back()-1]='(';
				resp[i-1]=')';
				c.pop_back();
			}
			else c.push_back(i);
		}
	}

	int tam=c.size();

	for(int i=0; i<tam; i++){
		if(i<tam/2){
			resp[c[i]-1]=')';
		}
		else{
			resp[c[i]-1]='(';
		}
	}

	cout << "! ";
	for(auto x:resp)
		cout << x;
	cout << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 4 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 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 7 ms 600 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 4 ms 448 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 232 ms 520 KB Output is correct
3 Correct 587 ms 528 KB Output is correct
4 Correct 559 ms 532 KB Output is correct
5 Correct 528 ms 528 KB Output is correct
6 Correct 551 ms 596 KB Output is correct
7 Correct 506 ms 1116 KB Output is correct
8 Correct 560 ms 528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 570 ms 1704 KB Output is correct
3 Correct 572 ms 908 KB Output is correct
4 Correct 623 ms 1588 KB Output is correct
5 Correct 600 ms 1140 KB Output is correct
6 Correct 560 ms 1696 KB Output is correct
7 Correct 516 ms 1064 KB Output is correct
8 Correct 520 ms 524 KB Output is correct