답안 #781265

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
781265 2023-07-13T01:31:53 Z devariaota Zagrade (COI20_zagrade) C++17
0 / 100
628 ms 1608 KB
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define keish                             ios_base::sync_with_stdio(0);       cin.tie(0); cout.tie(0)
      
using namespace std;

int n, q, ok;

signed main(){
      keish;
  cin >> n >> q;

      vector<char> c(n);
      vector<int> v;
      v.push_back(1);

      int cnt = n / 2;
      for(int i = 2; i <= n; i++){
            cout << "? " << v.back() << " " << i << endl;
            cin >> ok;
            if(ok){
                  c[v.back() - 1] = '(';
                  c[i - 1] = ')';
                  cnt--;
                  v.pop_back();
            }else{
                  v.push_back(i);
            }
      }

      for(auto x : v){
            if(cnt) c[x - 1] = ')', cnt--;
            else c[x - 1] = '(';
      }
      
      cout << "! "; for(auto x : c) cout << x; cout << endl;
}     
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Runtime error 0 ms 208 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 6 ms 324 KB Output is correct
3 Runtime error 1 ms 208 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Runtime error 1 ms 336 KB Execution killed with signal 13
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 628 ms 1608 KB Output is correct
3 Runtime error 0 ms 336 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -