Submission #336927

# Submission time Handle Problem Language Result Execution time Memory
336927 2020-12-17T11:01:20 Z MrDomino Zagrade (COI20_zagrade) C++14
0 / 100
1 ms 512 KB
#include <bits/stdc++.h>

using namespace std;

const int N = (int) 1e5 + 7;
int n;
int q;
int a[N];
vector<int> stk;

int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    if (stk.empty()) {
      stk.push_back(i);
      a[i] = +1;
      continue;
    }
    int j = stk.back();
    cout << j << " " << i << endl;
    int ret;
    cin >> ret;
    if (ret) {
      stk.pop_back();
      a[i] = -1;
    } else {
      stk.push_back(i);
      a[i] = +1;
    }
  }
  cout << "! ";
  for (int i = 1; i <= n; i++) {
    if (a[i] == +1) {
      cout << "(";
    } else {
      cout << ")";
    }
  }
  cout << endl;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -