# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
967600 | Isam | Superpozicija (COCI22_superpozicija) | C++17 | 46 ms | 1116 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |