답안 #1004641

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1004641 2024-06-21T11:07:25 Z leanchec Zagrade (COI20_zagrade) C++17
71 / 100
597 ms 1536 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 1 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 281 ms 528 KB Output is correct
3 Correct 588 ms 524 KB Output is correct
4 Correct 597 ms 528 KB Output is correct
5 Correct 590 ms 596 KB Output is correct
6 Correct 576 ms 524 KB Output is correct
7 Correct 597 ms 1536 KB Output is correct
8 Correct 540 ms 528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -