제출 #1152587

#제출 시각아이디문제언어결과실행 시간메모리
1152587YSH2020Zagrade (COI20_zagrade)C++20
0 / 100
0 ms416 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, q; cin >> n >> q;
  int ans[n];
  //suppose this is a valid bracket sequence.
  for (int j = 0; j < n; j++) {
    int started = 0;
    for (int i = j+1; i <= n-1; i += 2) {
      cout << "? " << ' ' << j+1 << ' ' << i+1 << '\n';
      int x; cin >> x;
      if (x == 1) {started = 1; break;}
    }
    if (started) ans[j] = 1;
    else ans[j] = 0;
  }
  cout << "! ";
  for (int i = 0; i < n; i++) {
    if (ans[i] == 0) cout << '(';
    else cout << ')';
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...