Submission #76587725
Source Code Expand
Copy
#include <stdio.h>int H, W;char S[16][16];int main(void) {int i, j;int h1, h2, w1, w2;int ans = 0;if (scanf("%d%d", &H, &W) != 2) return 1;for (i = 1; i <= H; i++) {if (scanf("%14s", S[i] + 1) != 1) return 1;}/* 問題文に書いてある通りそのまま実装 */for (h1 = 1; h1 <= H; h1++) {for (h2 = h1; h2 <= H; h2++) {for (w1 = 1; w1 <= W; w1++) {for (w2 = w1; w2 <= W; w2++) {int yes = 1;for (i = h1; i <= h2; i++) {for (j = w1; j <= w2; j++) {yes = yes && S[i][j] == S[h1 + h2 - i][w1 + w2 - j];}}ans += yes;}}}}printf("%d\n", ans);return 0;}
#include <stdio.h>
int H, W;
char S[16][16];
int main(void) {
int i, j;
int h1, h2, w1, w2;
int ans = 0;
if (scanf("%d%d", &H, &W) != 2) return 1;
for (i = 1; i <= H; i++) {
if (scanf("%14s", S[i] + 1) != 1) return 1;
}
/* 問題文に書いてある通りそのまま実装 */
for (h1 = 1; h1 <= H; h1++) {
for (h2 = h1; h2 <= H; h2++) {
for (w1 = 1; w1 <= W; w1++) {
for (w2 = w1; w2 <= W; w2++) {
int yes = 1;
for (i = h1; i <= h2; i++) {
for (j = w1; j <= w2; j++) {
yes = yes && S[i][j] == S[h1 + h2 - i][w1 + w2 - j];
}
}
ans += yes;
}
}
}
}
printf("%d\n", ans);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Spiral Galaxy |
| User | mikecat |
| Language | C23 (GCC 14.2.0) |
| Score | 200 |
| Code Size | 685 Byte |
| Status | AC |
| Exec Time | 0 ms |
| Memory | 1728 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample00.txt, sample01.txt |
| All | sample00.txt, sample01.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample00.txt | AC | 0 ms | 1596 KiB |
| sample01.txt | AC | 0 ms | 1612 KiB |
| testcase00.txt | AC | 0 ms | 1716 KiB |
| testcase01.txt | AC | 0 ms | 1596 KiB |
| testcase02.txt | AC | 0 ms | 1644 KiB |
| testcase03.txt | AC | 0 ms | 1616 KiB |
| testcase04.txt | AC | 0 ms | 1728 KiB |
| testcase05.txt | AC | 0 ms | 1576 KiB |
| testcase06.txt | AC | 0 ms | 1716 KiB |
| testcase07.txt | AC | 0 ms | 1612 KiB |
| testcase08.txt | AC | 0 ms | 1664 KiB |
| testcase09.txt | AC | 0 ms | 1728 KiB |
| testcase10.txt | AC | 0 ms | 1644 KiB |