답안 #373613

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
373613 2021-03-05T09:29:08 Z wind_reaper Zagrade (COI20_zagrade) C++17
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL); 
	
	int n, q;
	cin >> n >> q;
	vector<char> ans(n, '.');
	vector<int> stack;
	for(int i = 0; i < n; i++){
		if(stack.empty()){
			stack.push_back(i);
			continue;
		}
		cout << stack.back() + 1 << ' ' << i + 1 << endl;
		bool v;
		cin >> v;
		if(v){
			ans[stack.back()] = '(', ans[i] = ')';
			stack.pop_back();
		}
		else stack.push_back(i);
	}
	for(int i = 0; i < stack.size() / 2; i++)
		ans[i] = ')';
	for(int i = stack.size()/2; i < stack.size(); i++)
		ans[i] = '(';
	cout << "! ";
	for(int i = 0; i < n; i++)
		cout << ans[i];
	return 0; 
}

Compilation message

zagrade.cpp: In function 'int32_t main()':
zagrade.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  for(int i = 0; i < stack.size() / 2; i++)
      |                 ~~^~~~~~~~~~~~~~~~~~
zagrade.cpp:29:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i = stack.size()/2; i < stack.size(); i++)
      |                              ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 364 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 364 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -