Submission #00116
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #include <bits/stdc++.h> using namespace std; char p[1010][1010]; pair< int , int > it[1010][1010]; int c, n; bool isOK( int x, int y){ auto ydk = it[y][x]; y = ydk.first; x = ydk.second; return p[y][x] == p[y][n-x-1] && p[y][x] == p[n-y-1][x] && p[y][x] == p[n-y-1][n-x-1]; } int main(){ cin >> c >> n; for ( int i = 0;i < n;i++){ cin >> p[i]; } int sa = 0; int cnt = 0; for ( int i = 0;i < n/2;i++){ for ( int j = 0;j < n/2;j++){ it[i][j] = {i, j}; it[i][n-j-1] = {i, j}; it[n-i-1][j] = {i, j}; it[n-i-1][n-j-1] = {i, j}; int y = i; int x = j; if (isOK(x, y)){ cnt++; } } } int ans = 0; int ma = (n/2)*(n/2); if (cnt == ma){ ans++; } for ( int yta = 1;yta < c;yta++){ int m; cin >> m; for ( int i = 0;i < m;i++){ int x, y; cin >> y >> x; x--; y--; bool old = isOK(x, y); if (p[y][x] == '1' ){ p[y][x] = '0' ; } else { p[y][x] = '1' ; } bool now = isOK(x, y); if (old && !now){ cnt--; } if (!old && now){ cnt++; } } if (cnt == ma){ ans++; } } cout << ans << endl; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0006 - 品質管理 |
ユーザー名 | ARUMAKAN |
投稿日時 | 2019-09-10 16:40:29 |
言語 | C++14 |
状態 | Accepted |
得点 | 12 |
ソースコード長 | 1566 Byte |
最大実行時間 | 421 ms |
最大メモリ使用量 | 9576 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 12 / 12 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
00-sample1.in | AC | 25 ms | 2652 KB |
1
|
00-sample2.in | AC | 19 ms | 2472 KB |
1
|
20-maxsymm01.in | AC | 421 ms | 9464 KB |
1
|
20-maxsymm02.in | AC | 411 ms | 9440 KB |
1
|
40-symm-unsymm01.in | AC | 94 ms | 9416 KB |
1
|
40-symm-unsymm02.in | AC | 183 ms | 9392 KB |
1
|
40-symm-unsymm03.in | AC | 233 ms | 9364 KB |
1
|
40-symm-unsymm04.in | AC | 245 ms | 9472 KB |
1
|
40-symm-unsymm05.in | AC | 243 ms | 9576 KB |
1
|
40-symm-unsymm06.in | AC | 205 ms | 9548 KB |
1
|