# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
781281 | 2023-07-13T01:59:42 Z | christinelynn | Zagrade (COI20_zagrade) | C++17 | 1 ms | 208 KB |
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pii pair<int,int> #define pll pair<long long, long long> int n,q,sisa; stack<int> st; char s[100069]; int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int i,j; cin>>n>>q; sisa = n/2; for(i=1;i<=n;i++) { if(st.empty()) { st.push(i); continue; } cout<<">>> ? "<<st.top()<<" "<<i<<'\n'; cout.flush(); bool valid; cin>>valid; if(valid) { s[st.top()] = '('; s[i] = ')'; sisa--; st.pop(); } else { st.push(i); } } while(!st.empty()) { int x = st.top(); st.pop(); if(sisa) { s[x] = ')'; sisa--; } else { s[x] = '('; } } cout<<">>> ! "; for(i=1;i<=n;i++) { cout<<s[i]; if(i == n) { cout<<'\n'; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 208 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 208 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 208 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 208 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |