Submission #967600

#TimeUsernameProblemLanguageResultExecution timeMemory
967600IsamSuperpozicija (COCI22_superpozicija)C++17
0 / 110
46 ms1116 KiB
#include<bits/stdc++.h> using namespace std; constexpr int sz = 200002; int n, a[sz], b[sz]; string z; signed main(){ ios_base::sync_with_stdio(0); int T; cin >> T; function<void()> test_case = [](){ cin >> n >> z; for(register int i = 1; i <= n; ++i){ cin >> a[i] >> b[i]; a[i]--, b[i]--; } //assert(n<=10); for(register int mask = 0; mask < (1 << n); ++mask){ bool flag = true; int tot(0); for(register int i = 1; i <= n && flag; ++i){ if(mask & (1<<(i-1))){ tot += (z[a[i]]=='('?1:-1); }else{ tot += (z[b[i]]=='('?1:-1); } flag &= (tot >= 0); } flag &= tot==0; if(flag){ for(register int i = 0; i < n; ++i){ cout << 1 - (bool)(mask & (1 << i)) << " \n"[i==n-1]; } return; } } cout << -1 << '\n'; }; while(T--) test_case(); return 0; }

Compilation message (stderr)

Main.cpp: In lambda function:
Main.cpp:18:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   18 |   for(register int i = 1; i <= n; ++i){
      |                    ^
Main.cpp:25:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 |   for(register int mask = 0; mask < (1 << n); ++mask){
      |                    ^~~~
Main.cpp:31:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   31 |    for(register int i = 1; i <= n && flag; ++i){
      |                     ^
Main.cpp:48:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   48 |     for(register int i = 0; i < n; ++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...