Submission #3875962
Source Code Expand
#include<cstdio> #include<algorithm> using namespace std; int n, m, w[110][110], CX[110], CY[110]; char p[210][210], q[4]; long long res = 1, Mod = 1000000007; int main() { int i, j; scanf("%d%d", &n, &m); for (i = 1; i <= n; i++) { scanf("%s", p[i] + 1); } if (n % 2 == 1) { for (i = 1; i <= m / 2; i++) { if (p[n / 2 + 1][i] != p[n / 2 + 1][m + 1 - i]) { res = res * 2 % Mod; break; } } } if (m % 2 == 1) { for (i = 1; i <= n / 2; i++) { if (p[i][m / 2 + 1] != p[n + 1 - i][m / 2 + 1]) { res = res * 2 % Mod; break; } } } for (i = 1; i <= n / 2; i++) { for (j = 1; j <= m / 2; j++) { q[0] = p[i][j]; q[1] = p[n + 1 - i][j]; q[2] = p[i][m + 1 - j]; q[3] = p[n + 1 - i][m + 1 - j]; sort(q, q + 4); int s = 0; do { s++; } while (next_permutation(q, q + 4)); w[i][j] = s; if (s == 24) { CX[i] = 1, CY[j] = 1; res = res * 12 % Mod; } else res = res*s%Mod; } } int c = 0; for (i = 1; i <= 100; i++)c += CX[i] + CY[i]; if (c > 0)c--; for (i = 0; i < c; i++)res = res * 2 % Mod; printf("%lld\n", res); return 0; }
Submission Info
Submission Time | |
---|---|
Task | I - Reverse Grid |
User | ainta |
Language | C++14 (GCC 5.4.1) |
Score | 1900 |
Code Size | 1166 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:9:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d", &n, &m); ^ ./Main.cpp:11:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", p[i] + 1); ^
Judge Result
Set Name | sample | all | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1900 / 1900 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
all | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 1 ms | 128 KB |
01-02.txt | AC | 1 ms | 128 KB |
01-03.txt | AC | 1 ms | 128 KB |
01-04.txt | AC | 1 ms | 128 KB |
01-05.txt | AC | 1 ms | 128 KB |
01-06.txt | AC | 1 ms | 128 KB |
01-07.txt | AC | 1 ms | 128 KB |
01-08.txt | AC | 1 ms | 256 KB |
01-09.txt | AC | 1 ms | 256 KB |
01-10.txt | AC | 1 ms | 256 KB |
01-11.txt | AC | 1 ms | 256 KB |
01-12.txt | AC | 1 ms | 256 KB |
01-13.txt | AC | 1 ms | 256 KB |
01-14.txt | AC | 1 ms | 256 KB |
01-15.txt | AC | 1 ms | 256 KB |
01-16.txt | AC | 2 ms | 256 KB |
01-17.txt | AC | 2 ms | 256 KB |
01-18.txt | AC | 2 ms | 256 KB |
01-19.txt | AC | 2 ms | 256 KB |
01-20.txt | AC | 1 ms | 256 KB |
01-21.txt | AC | 1 ms | 256 KB |
01-22.txt | AC | 1 ms | 128 KB |
01-23.txt | AC | 1 ms | 256 KB |
01-24.txt | AC | 2 ms | 256 KB |
01-25.txt | AC | 2 ms | 256 KB |
01-26.txt | AC | 2 ms | 256 KB |
01-27.txt | AC | 1 ms | 128 KB |
01-28.txt | AC | 1 ms | 256 KB |
01-29.txt | AC | 1 ms | 256 KB |
01-30.txt | AC | 1 ms | 256 KB |
01-31.txt | AC | 2 ms | 256 KB |
01-32.txt | AC | 2 ms | 256 KB |
01-33.txt | AC | 2 ms | 256 KB |
01-34.txt | AC | 2 ms | 256 KB |
01-35.txt | AC | 2 ms | 256 KB |
sample-01.txt | AC | 1 ms | 128 KB |
sample-02.txt | AC | 1 ms | 128 KB |