제출 #1152394

#제출 시각아이디문제언어결과실행 시간메모리
1152394justin271828Zagrade (COI20_zagrade)C++20
0 / 100
235 ms508 KiB
#include <bits/stdc++.h> using namespace std; int main() { int N, Q; cin >> N >> Q; char arr[N+5]; memset(arr, 'a', sizeof(arr)); int start = 1; int end = 2; int count = N/2; while (end <= N) { int ans; cout << "? " << start << " " << end << "\n"; cin >> ans; if (ans == 1) { count--; arr[start] = '('; arr[end] = ')'; start--;} else start = end; end++; } int temp = 0; int index = 1; while (temp < count) { if (arr[index] == 'a') { arr[index] = ')'; temp++; } index++; } temp = 0; while (temp < count) { if (arr[index] == 'a') { arr[index] = '('; temp++; } index++; } cout << "! "; for (int i = 1; i <= N; i++) cout << arr[i]; return 0;}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...