Submission #651088

# Submission time Handle Problem Language Result Execution time Memory
651088 2022-10-17T02:54:16 Z _HDH Zagrade (COI20_zagrade) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

#ifdef LOCAL
#include <debug.h>
#else
#define debug(...) 1001
#endif

using namespace std;
#define all(x) x.begin(), x.end()
#define st first
#define nd second
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define file "TEMPLATE"

typedef long long ll;
typedef pair<int, int> ii;
typedef array<int, 3> iii;
typedef vector<int> vi;
typedef vector<ll> vl;

bool const SINGLE_TEST = 1;

bool ask(int l, int r){
	cout << "? " << l << " " << r << "\n";
	cout.flush();
	bool ans; cin >> ans;
	return ans;
}

void answer(string s){
	cout << "!" << s << "\n";
	cout.flush();
}

void solve(){
	int n, q; cin >> n >> q;
	
	string s(n + 1, ' ');
	stack<int> st;
	for (int i = 1; i <= n; i++){
		if (!st.empty() && ask(st.top(), i)){
			s[st.top()] = '(';
			s[i] = ')';
			st.pob();
		}else st.pb(i);
	}
	
	int z = sz.size() / 2;
	while (!st.empty()){
		if (st.size() <= z) s[st.top()] = ')';
		else s[st.top()] = '(';
		st.pob();
	}
	answer(s);
}

int main(){
	ios_base::sync_with_stdio(0);//      the
	cin.tie(0);cout.tie(0);// 	    magical lines	
	// freopen(file".inp", "r", stdin);
	// freopen(file".out", "w", stdout);
	int t;
	if (SINGLE_TEST) t = 1;
	else cin >> t;
	while (t--) solve();
	return 0;
}//it's coding time!

Compilation message

zagrade.cpp: In function 'void solve()':
zagrade.cpp:17:13: error: 'class std::stack<int>' has no member named 'pop_back'
   17 | #define pob pop_back
      |             ^~~~~~~~
zagrade.cpp:51:7: note: in expansion of macro 'pob'
   51 |    st.pob();
      |       ^~~
zagrade.cpp:16:12: error: 'class std::stack<int>' has no member named 'push_back'
   16 | #define pb push_back
      |            ^~~~~~~~~
zagrade.cpp:52:12: note: in expansion of macro 'pb'
   52 |   }else st.pb(i);
      |            ^~
zagrade.cpp:55:10: error: 'sz' was not declared in this scope
   55 |  int z = sz.size() / 2;
      |          ^~
zagrade.cpp:57:17: warning: comparison of integer expressions of different signedness: 'std::stack<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   57 |   if (st.size() <= z) s[st.top()] = ')';
      |                 ^
zagrade.cpp:17:13: error: 'class std::stack<int>' has no member named 'pop_back'
   17 | #define pob pop_back
      |             ^~~~~~~~
zagrade.cpp:59:6: note: in expansion of macro 'pob'
   59 |   st.pob();
      |      ^~~