# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
706254 | 2023-03-06T08:01:02 Z | vjudge1 | Zagrade (COI20_zagrade) | C++17 | 859 ms | 1156 KB |
#include <bits/stdc++.h> #include <array> #define all(v) (v.begin()), (v.end()) #define setall(a, val) for(auto& x : a) x = val #define ll long long clock_t start_time; double get_time() { return (double)(clock() - start_time) / CLOCKS_PER_SEC; } void init() { #ifndef ONLINE_JUDGE: FILE* _ = freopen("in.txt", "r", stdin); start_time = clock(); #endif } const ll MOD = 1e9 + 7; const ll N = 5e3 + 7; const ll M = 1e2 + 7; using namespace std; //#################################################################################### int main() { //ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(0)); init(); int n, q; cin >> n >> q; string s; stack<pair<char, int>> st; for (int i = 0; i < n; i++) { if (st.size()) { cout << "? " << st.top().second + 1 << ' ' << i + 1 << endl; int b; cin >> b; if (b == 1) { s += ')'; st.pop(); } else { s += '('; st.push({ '(', i }); } } else { s += '('; st.push({ '(', i }); } } cout << "! " << s << endl; cerr << get_time() << "s" << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 6 ms | 208 KB | Output is correct |
3 | Correct | 10 ms | 280 KB | Output is correct |
4 | Correct | 9 ms | 304 KB | Output is correct |
5 | Correct | 10 ms | 300 KB | Output is correct |
6 | Correct | 8 ms | 428 KB | Output is correct |
7 | Correct | 9 ms | 208 KB | Output is correct |
8 | Correct | 10 ms | 296 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Mismatch at position 1. Expected ), found ( |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 340 ms | 656 KB | Output is correct |
3 | Correct | 759 ms | 680 KB | Output is correct |
4 | Correct | 812 ms | 540 KB | Output is correct |
5 | Correct | 547 ms | 472 KB | Output is correct |
6 | Correct | 739 ms | 604 KB | Output is correct |
7 | Correct | 859 ms | 1156 KB | Output is correct |
8 | Correct | 721 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Mismatch at position 1. Expected ), found ( |
2 | Halted | 0 ms | 0 KB | - |