답안 #1003920

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1003920 2024-06-20T20:01:26 Z vjudge1 Zagrade (COI20_zagrade) C++17
71 / 100
588 ms 1776 KB
#include <bits/stdc++.h>

using namespace std;

int marc[100005];
stack<int> st;

int main(){
	int n,q; cin>>n>>q;
	for(int i = 1; i <= n; i++){
		if(st.size() == 0){
			marc[i] = 1;
			st.push(i);
			continue;
		}
		cout<<"? "<<st.top()<<" "<<i<<endl;
		int x; cin>>x;
		if(x == 0){
			marc[i] = 1;
			st.push(i);
		}else{
			marc[i] = 0;
			st.pop();
		}
	}
	cout<<"! ";
	for(int i = 1; i <= n; i++){
		if(marc[i] == 0)cout<<")";
		else cout<<"(";
	}cout<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 4 ms 344 KB Output is correct
5 Correct 4 ms 436 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 4 ms 444 KB Output is correct
8 Correct 4 ms 444 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 248 ms 828 KB Output is correct
3 Correct 546 ms 1536 KB Output is correct
4 Correct 519 ms 1252 KB Output is correct
5 Correct 588 ms 1196 KB Output is correct
6 Correct 579 ms 1632 KB Output is correct
7 Correct 552 ms 1776 KB Output is correct
8 Correct 523 ms 1308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Mismatch at position 1. Expected ), found (
2 Halted 0 ms 0 KB -