Submission #706364

#TimeUsernameProblemLanguageResultExecution timeMemory
706364vjudge1Zagrade (COI20_zagrade)C++17
0 / 100
0 ms208 KiB
#include <bits/stdc++.h> using namespace std; #define int long long // #define endl '\n' const int M = 4e5+5, MOD = 998244353; char s[M]; signed main() { cin.tie(0)->sync_with_stdio(0); int n, q; cin >> n >> q; int cnt = n/2; stack<int> st; for (int i = 1; i <= n; i++) { if (!st.size()) st.push(i); else { cout << "? " << st.top() << ' ' << i << endl; int x; cin >> x; if (x) cnt--, s[i]=')', s[st.top()] = '(', st.pop(); else st.push(i); } } for (int i = 1; i <= n; i++) if (!s[i]) cnt?s[i]=')', cnt--:s[i]='('; for (int i = 1; i <= n; i++) cout << s[i]; cout << endl; return 0; } /* 1234567890123456 ))(()(())()(()() )))()(())())()() 16 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0 1 */

Compilation message (stderr)

zagrade.cpp: In function 'int main()':
zagrade.cpp:31:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   31 |     for (int i = 1; i <= n; i++) cout << s[i]; cout << endl;
      |     ^~~
zagrade.cpp:31:48: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   31 |     for (int i = 1; i <= n; i++) cout << s[i]; cout << endl;
      |                                                ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...