#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
signed main(){
//fastio
int n,m;
cin >> n >> m;
vector<pair<int,int>> v;
for(int i = 0;i < m;i++){
int l,r;
cin >> l >> r;
l--, r--;
v.push_back({l,r});
}
for(int i = 0;i < (1<<m);i++){
int cnt[n] = {};
for(int j = 0;j < m;j++){
if(i&(1<<j)){
int l = v[j].first, r = v[j].second;
while(true){
cnt[l] |= 2;
if(l==r) break;
l = (l+1)%n;
}
}else{
int l = v[j].first, r = v[j].second;
while(true){
cnt[l] |= 1;
if(l==r) break;
l = (l+1)%n;
}
}
}
bool check = true;
for(int j = 0;j < n;j++){
if(cnt[j]!=3){
check = false;
}
}
if(check){
for(int j = 0;j < m;j++){
if(i&(1<<j)) cout << 1;
else cout << 0;
}
return 0;
}
}
cout << "impossible\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3067 ms |
9052 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |