提出 #19997687
ソースコード 拡げる
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3") vector<string> c; int get(int i, int j) { int cnt = 0; if (c[i - 1][j] == '#') cnt++; if (c[i + 1][j] == '#') cnt++; if (c[i][j - 1] == '#') cnt++; if (c[i][j + 1] == '#') cnt++; if (cnt == 0) return 1; if (cnt == 1) return 2; if (cnt == 2) { if ((c[i][j - 1] == '#' && c[i][j + 1] == '#') || (c[i - 1][j] == '#' && c[i + 1][j] == '#')) { return 5; } else { return 4; } } if (cnt == 0) return 6; return cnt; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int h, w; cin >> h >> w; c.resize(h); for (int i = 0; i < h; i++) { cin >> c[i]; } int n = 0, n1 = 0; for (int i = 1; i < h - 1; i++) { for (int j = 1; j < w - 1; j++) { if (c[i][j] == '#') { if (c[i][j - 1] == '.' && c[i + 1][j] == '.') { n += 2; } if (c[i][j - 1] == '.' && c[i - 1][j] == '.') { n += 2; } if (c[i][j + 1] == '.' && c[i + 1][j] == '.') { n += 2; } if (c[i][j + 1] == '.' && c[i - 1][j] == '.') { n += 2; } } if (c[i][j] == '.') { if (c[i][j - 1] == '#' && c[i + 1][j] == '#') { n += 2; } if (c[i][j - 1] == '#' && c[i - 1][j] == '#') { n += 2; } if (c[i][j + 1] == '#' && c[i + 1][j] == '#') { n += 2; } if (c[i][j + 1] == '#' && c[i - 1][j] == '#') { n += 2; } } } } cout << n / 2; return 0; }
提出情報
提出日時 | |
---|---|
問題 | C - Digital Graffiti |
ユーザ | GrgaExe |
言語 | C++ (GCC 9.2.1) |
得点 | 300 |
コード長 | 2258 Byte |
結果 | AC |
実行時間 | 5 ms |
メモリ | 3652 KiB |
コンパイルエラー
./Main.cpp: In function ‘int main()’: ./Main.cpp:52:16: warning: unused variable ‘n1’ [-Wunused-variable] 52 | int n = 0, n1 = 0; | ^~
ジャッジ結果
セット名 | Sample | All | ||||
---|---|---|---|---|---|---|
得点 / 配点 | 0 / 0 | 300 / 300 | ||||
結果 |
|
|
セット名 | テストケース |
---|---|
Sample | sample_01.txt |
All | handmade_00.txt, handmade_01.txt, handmade_02.txt, handmade_03.txt, oldsample_00.txt, oldsample_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, sample_01.txt |
ケース名 | 結果 | 実行時間 | メモリ |
---|---|---|---|
handmade_00.txt | AC | 5 ms | 3608 KiB |
handmade_01.txt | AC | 3 ms | 3516 KiB |
handmade_02.txt | AC | 4 ms | 3652 KiB |
handmade_03.txt | AC | 2 ms | 3540 KiB |
oldsample_00.txt | AC | 2 ms | 3560 KiB |
oldsample_01.txt | AC | 2 ms | 3488 KiB |
random_00.txt | AC | 2 ms | 3520 KiB |
random_01.txt | AC | 3 ms | 3644 KiB |
random_02.txt | AC | 2 ms | 3604 KiB |
random_03.txt | AC | 2 ms | 3568 KiB |
random_04.txt | AC | 3 ms | 3612 KiB |
random_05.txt | AC | 1 ms | 3636 KiB |
random_06.txt | AC | 2 ms | 3540 KiB |
random_07.txt | AC | 2 ms | 3568 KiB |
random_08.txt | AC | 2 ms | 3488 KiB |
random_09.txt | AC | 3 ms | 3540 KiB |
random_10.txt | AC | 3 ms | 3468 KiB |
random_11.txt | AC | 2 ms | 3612 KiB |
random_12.txt | AC | 3 ms | 3596 KiB |
random_13.txt | AC | 3 ms | 3524 KiB |
random_14.txt | AC | 2 ms | 3564 KiB |
random_15.txt | AC | 2 ms | 3644 KiB |
random_16.txt | AC | 2 ms | 3560 KiB |
random_17.txt | AC | 2 ms | 3480 KiB |
random_18.txt | AC | 3 ms | 3644 KiB |
random_19.txt | AC | 2 ms | 3580 KiB |
sample_01.txt | AC | 2 ms | 3540 KiB |