# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1081405 | 2024-08-30T04:10:53 Z | juicy | Zagrade (COI20_zagrade) | C++17 | 619 ms | 1712 KB |
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "debug.h" #else #define debug(...) 42 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); auto qry = [&](int i, int j) { cout << "? " << i + 1 << " " << j + 1 << endl; int r; cin >> r; return r; }; int n, q; cin >> n >> q; string s(n, '('); vector<int> st{0}; for (int i = 1; i < n; ++i) { if (st.size() && qry(st.back(), i)) { s[i] = ')'; st.pop_back(); } else { st.push_back(i); } } for (int i = 0; i < st.size(); ++i) { if (i * 2 < n) { s[st[i]] = ')'; } } cout << "! " << s << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 596 KB | Output is correct |
2 | Correct | 2 ms | 344 KB | Output is correct |
3 | Correct | 5 ms | 344 KB | Output is correct |
4 | Correct | 5 ms | 344 KB | Output is correct |
5 | Correct | 4 ms | 344 KB | Output is correct |
6 | Correct | 4 ms | 344 KB | Output is correct |
7 | Correct | 6 ms | 344 KB | Output is correct |
8 | Correct | 4 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 6 ms | 600 KB | Output is correct |
3 | Incorrect | 5 ms | 344 KB | Mismatch at position 511. Expected (, found ) |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 294 ms | 520 KB | Output is correct |
3 | Correct | 576 ms | 528 KB | Output is correct |
4 | Correct | 515 ms | 532 KB | Output is correct |
5 | Correct | 619 ms | 528 KB | Output is correct |
6 | Correct | 579 ms | 528 KB | Output is correct |
7 | Correct | 555 ms | 1352 KB | Output is correct |
8 | Correct | 590 ms | 524 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 546 ms | 1712 KB | Output is correct |
3 | Incorrect | 571 ms | 1148 KB | Mismatch at position 49727. Expected (, found ) |
4 | Halted | 0 ms | 0 KB | - |