#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < ll , ll >
#define F first
#define S second
#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
using namespace std;
/// khodaya komak kon
/// ya navid navid
const int N=1e5+100;
int n, m, L[N], R[N];
bool M[N][2];
string S(int mask) {
string s = "";
for (int i = 0; i < m; i++) s += '0' + ((mask >> i) & 1);
return s;
}
int32_t main() {
sync;
ll n,m;
cin >> n >> m;
for (int i = 0; i < m; i++)
cin >> L[i] >> R[i], L[i]--, R[i]--;
for (int mask = 0; mask < (1 << m); mask++) {
for (int i = 0; i < n; i++) M[i][0] = M[i][1] = false;
for (int i = 0; i < m; i++) {
for (int j = L[i]; j != R[i]; j = (j + 1) % n) M[j][(mask >> i) & 1] = true;
M[R[i]][(mask >> i) & 1] = true;
}
bool flag = true;
for (int i = 0; i < n; i++) flag &= M[i][0] & M[i][1];
if (flag){
S(mask);
return 0;
}
}
cout << "impossible" << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
376 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
376 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
376 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3008 ms |
2040 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
376 KB |
Unexpected end of file - token expected |
2 |
Halted |
0 ms |
0 KB |
- |