#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ent "\n"
const int maxn = 1e6 + 100;
const ll INF = (ll)1e18 + 100;
const int inf = 1e9 + 100;
const int MOD = 1e9 + 123;
const int maxl = 26;
const int P = 31;
int n, m;
int a[maxn];
int b[maxn];
int c[1010][1010];
void test(){
cin >> n >> m;
for(int i = 1; i <= n; i++){
cin >> a[i] >> b[i];
}
for(int i = 1; i <= n; i++){
int j = i - 1;
if(!j) j = n;
if(a[i] == a[j]){
int l = min(b[i], b[j]);
int r = b[i] + b[j] - l;
for(int y = l; y < r; y++){
c[a[i]][y] ^= 1;
}
}
}
for(int i = 0; i < m; i++){
for(int j = 0; j < 10; j++){
if(i) c[i][j] ^= c[i-1][j];
cout << c[i][j];
} cout << endl;
}
int ans = 0;
for(int i = 0; i < m; i++){
int ok = 0;
for(int j = 0; j <= 1000; j++){
if(c[i][j]){
ok = 1;
if(c[i+1][j] && c[i][j+1] && c[i+1][j+1]){
c[i][j] = 0;
c[i+1][j] = 0;
c[i][j+1] = 0;
c[i+1][j+1] = 0;
} else{
ok = 2;
break;
}
}
}
if(ok == 2) break;
if(ok == 1) continue;
ans = i + 1;
}
cout << ans;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t; t = 1;
while(t--) test();
cout << ent;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
4448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
4448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
6748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
6 ms |
8792 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
48 ms |
26428 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
4448 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |