提出 #36056139
ソースコード 拡げる
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int main() {
vector<string> s(9);
rep(i, 9) {
cin >> s[i];
}
auto f = [&](int x, int y) {
if (x < 0 || x >= 9 || y < 0 || y >= 9) return false;
if (s[y][x] == '.') return false;
return true;
};
set<vector<pii>> st;
rep(y, 9) rep(x, 9) {
rep(dy, 9) rep(dx, 9) {
if (dy == 0 && dx == 0) continue;
bool ok = true;
if (!f(x, y)) ok = false;
if (!f(x + dx, y + dy)) ok = false;
if (!f(x + dx - dy, y + dy + dx)) ok = false;
if (!f(x - dy, y + dx)) ok = false;
if (ok) {
vector<pii> v(4);
v[0] = pii{x, y};
v[1] = pii{x + dx, y + dy};
v[2] = pii{x + dx - dy, y + dy + dx};
v[3] = pii{x - dy, y + dx};
sort(v.begin(), v.end());
st.insert(v);
}
}
}
cout << st.size() << endl;
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Counting Squares |
| ユーザ | icchipost |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 300 |
| コード長 | 1166 Byte |
| 結果 | AC |
| 実行時間 | 8 ms |
| メモリ | 3584 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_01.txt | AC | 8 ms | 3532 KiB |
| 00_sample_02.txt | AC | 2 ms | 3376 KiB |
| 01_test_01.txt | AC | 2 ms | 3480 KiB |
| 01_test_02.txt | AC | 3 ms | 3516 KiB |
| 01_test_03.txt | AC | 6 ms | 3372 KiB |
| 01_test_04.txt | AC | 2 ms | 3528 KiB |
| 01_test_05.txt | AC | 2 ms | 3544 KiB |
| 01_test_06.txt | AC | 2 ms | 3408 KiB |
| 01_test_07.txt | AC | 2 ms | 3456 KiB |
| 01_test_08.txt | AC | 2 ms | 3560 KiB |
| 01_test_09.txt | AC | 2 ms | 3520 KiB |
| 01_test_10.txt | AC | 3 ms | 3512 KiB |
| 01_test_11.txt | AC | 2 ms | 3584 KiB |
| 01_test_12.txt | AC | 2 ms | 3580 KiB |
| 01_test_13.txt | AC | 3 ms | 3504 KiB |