Submission #373615

# Submission time Handle Problem Language Result Execution time Memory
373615 2021-03-05T09:29:53 Z wind_reaper Zagrade (COI20_zagrade) C++17
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>

using namespace std;

int32_t main(){	
	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:24:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(int i = 0; i < stack.size() / 2; i++)
      |                 ~~^~~~~~~~~~~~~~~~~~
zagrade.cpp:26:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for(int i = stack.size()/2; i < stack.size(); i++)
      |                              ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 364 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 364 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 364 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 364 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -