이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n,m;
void subtask1(){
int l[200];
int r[200];
int k[200];
int v[200];
for (int i = 0; i<m; i++){
cin>>l[i]>>r[i]>>k[i]>>v[i];
}
for (int i = 0; i<(1<<n); i++){
//cout<<"check\n";
bool works = true;
for (int j = 0; j<m; j++){
int cnt0 = 0;
for (int x = l[j]; x<=r[j]; x++){
if ((1<<x)&i){
continue;
} else {
cnt0++;
}
}
//cout<<l[j]<<' '<<r[j]<<' '<<cnt0<<'\n';
if (!((v[j]&&cnt0<k[j])||((!v[j])&&cnt0>=k[j]))){
works=false;
break;
}
}
if (works){
for (int x = 0; x<n; x++){
cout<<bool((1<<x)&i)<<' ';
}cout<<'\n';
return;
}
}
cout<<-1<<'\n';
return;
}
int main(){
cin>>n>>m;
if (n<=18){
subtask1();
}
}
| # | 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... |