Submission #1152456

#TimeUsernameProblemLanguageResultExecution timeMemory
1152456simuyuZagrade (COI20_zagrade)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second ll N, Q; string res; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> N >> Q; for (ll i=0; i<N; i++) { res += "?"; } ll left, right; int resp; for (ll sz=2; sz<=N; sz+=2) { ll startpt=0; while (startpt<=N-sz) { cout << "? " << startpt+1 << ' ' << startpt+sz << endl; // this is in their coordinates not ours cin >> resp; if (resp) { // is valid --> pattern known // from startpt to startpt+sz (inclusive, exclusive) is a "block" left = startpt; right = startpt+sz; try { while (right > left) { while (res[right-1] != '?') { right -= 2; if (right<=left) break; } while (res[left] != '?') { left += 2; if (right<=left) break; } if (right <= left) break; cout << "LEFT: " << left << ", RIGHT: " << right << "; "; for (int i=left; i<right; i++) { cout << res[i]; } cout << endl; // now the first and last are '(' and ')' res[left] = '('; res[right-1] = ')'; left++; right--; } } catch (exception) { ll a = 0; while true { a ++; } } // set already yay startpt += sz; continue; } startpt++; } } cout << "! " << res << endl; return 0; }

Compilation message (stderr)

zagrade.cpp: In function 'int main()':
zagrade.cpp:63:27: error: expected '(' before 'true'
   63 |                     while true {
      |                           ^~~~
      |                           (
zagrade.cpp:63:31: error: expected ')' before '{' token
   63 |                     while true {
      |                           ~~~~^~
      |                               )