Submission #1081403

# Submission time Handle Problem Language Result Execution time Memory
1081403 2024-08-30T04:10:05 Z juicy Zagrade (COI20_zagrade) C++17
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);

  auto qry = [&](int i, int j) {
    cout << i + 1 << " " << j + 1 << endl;
    int r; cin >> r;
    return r;
  };
  int n, q; cin >> n >> q;
  string s(n, '(');
  vector<int> st{0};
  for (int i = 1; i < n; ++i) {
    if (st.size() && qry(st.back(), i)) {
      s[i] = ')';
      st.pop_back();
    } else {
      st.push_back(i);
    }
  }
  for (int i = 0; i < st.size(); ++i) {
    if (i * 2 < n) {
      s[st[i]] = ')';
    }
  }
  cout << s << endl;
  return 0;
}

Compilation message

zagrade.cpp: In function 'int main()':
zagrade.cpp:30:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for (int i = 0; i < st.size(); ++i) {
      |                   ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -