Submission #1217562

#TimeUsernameProblemLanguageResultExecution timeMemory
1217562VMaksimoski008Zagrade (COI20_zagrade)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ar array //#define int long long using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int mod = 1e9 + 7; const ll inf = 1e18; const int N = 1e5 + 5; int ask(int i, int j) { cout << "? " << i << " " << j << endl; int x; cin >> x; return x; } signed main() { int n, q; cin >> n >> q; string ans(n+1, '.'); ans[1] = '('; stack<int> st; st.push(1); for(int i=2; i<=n; i++) { if(st.empty()) { st.push(i); s[i] = '('; continue; } int x = ask(st.top(), i); if(x == 1) { ans[i] = ')'; st.pop(); } else { ans[i] = '('; st.push(i); } } cout << "! "; for(int i=1; i<=n; i++) cout << ans[i]; cout << endl; }

Compilation message (stderr)

zagrade.cpp: In function 'int main()':
zagrade.cpp:30:13: error: 's' was not declared in this scope
   30 |             s[i] = '(';
      |             ^