Submission #373616

#TimeUsernameProblemLanguageResultExecution timeMemory
373616wind_reaperZagrade (COI20_zagrade)C++17
0 / 100
1 ms492 KiB
#include <bits/stdc++.h> using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n, q; cin >> n >> q; vector<char> ans(n, '.'); vector<int> stack; for(int i = 0; i < n; i++){ if(stack.empty()){ stack.push_back(i); continue; } cout << stack.back() + 1 << ' ' << i + 1 << endl; bool v; cin >> v; if(v){ ans[stack.back()] = '(', ans[i] = ')'; stack.pop_back(); } else stack.push_back(i); } for(int i = 0; i < stack.size() / 2; i++) ans[stack[i]] = ')'; for(int i = stack.size()/2; i < stack.size(); i++) ans[stack[i]] = '('; cout << "! "; for(int i = 0; i < n; i++) cout << ans[i]; return 0; }

Compilation message (stderr)

zagrade.cpp: In function 'int32_t main()':
zagrade.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  for(int i = 0; i < stack.size() / 2; i++)
      |                 ~~^~~~~~~~~~~~~~~~~~
zagrade.cpp:29:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i = stack.size()/2; i < stack.size(); i++)
      |                              ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...