Submission #781259

# Submission time Handle Problem Language Result Execution time Memory
781259 2023-07-13T01:24:49 Z kebine Zagrade (COI20_zagrade) C++17
0 / 100
1 ms 208 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 + 5);
      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()] = '(';
                  c[i] = ')';
                  cnt--;
                  v.pop_back();
            }else{
                  v.push_back(i);
            }
      }

      for(auto x : v){
            if(cnt) c[x] = ')', cnt--;
            else c[x] = '(';
      }
      
      cout << "! "; for(auto x : c) cout << x; cout << endl;
}     
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Answer length should be 2, but it is 7
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Answer length should be 2, but it is 7
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Answer length should be 4, but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Answer length should be 4, but it is 9
2 Halted 0 ms 0 KB -