Submission #1985440
Source Code Expand
#include <iostream> using namespace std; int H, W; int A, B; char map[205][205]; int cnt[5]; int main(void) { cin >> H >> W; cin >> A >> B; for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ cin >> map[j][i]; } } string s = " "; bool symx, symy; for(int x = 0; x < W/2; x++){ for(int y = 0; y < H/2; y++){ s[0] = map[x][y]; s[1] = map[W-x-1][y]; s[2] = map[x][H-y-1]; s[3] = map[W-x-1][H-y-1]; if(s == "....") continue; if(s == "SSSS"){ cnt[0]++; continue; } symx = (s == "SS.." || s == "..SS"); symy = (s == "S.S." || s == ".S.S"); if(symx && symy) cnt[3]++; else if(symx) cnt[1]++; else if(symy) cnt[2]++; else cnt[4]++; } } if((s[1]+s[3])*B > (s[2]+s[3])*A){ s[1] += s[3]; s[2] = 0; }else{ s[2] += s[3]; s[1] = 0; } s[3] = 0; int ans = 0; ans += cnt[0] * (A+B); ans += cnt[1] * B; ans += cnt[2] * A; ans += A+B; bool flag = true; for(int x = 0; x < W; x++){ for(int y = 0; y < H; y++){ if(map[x][y] != map[W-x-1][y]) flag = false; } } if(flag) ans -= B; flag = true; for(int x = 0; x < W; x++){ for(int y = 0; y < H; y++){ if(map[x][y] != map[x][H-y-1]) flag = false; } } if(flag) ans -= A; cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - 石 |
User | leaf1415 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1330 Byte |
Status | WA |
Exec Time | 4 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 600 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | WA | 4 ms | 256 KB |
02.txt | WA | 4 ms | 256 KB |
03.txt | WA | 4 ms | 256 KB |
04.txt | WA | 4 ms | 256 KB |
05.txt | WA | 4 ms | 256 KB |
06.txt | WA | 4 ms | 256 KB |
07.txt | WA | 4 ms | 256 KB |
08.txt | WA | 4 ms | 256 KB |
09.txt | WA | 4 ms | 256 KB |
10.txt | AC | 4 ms | 256 KB |
11.txt | WA | 4 ms | 256 KB |
12.txt | WA | 4 ms | 256 KB |
13.txt | WA | 4 ms | 256 KB |
14.txt | WA | 4 ms | 256 KB |
15.txt | WA | 4 ms | 256 KB |
16.txt | WA | 4 ms | 256 KB |
17.txt | AC | 3 ms | 256 KB |
18.txt | AC | 4 ms | 256 KB |
19.txt | AC | 4 ms | 256 KB |
20.txt | AC | 4 ms | 256 KB |
21.txt | AC | 4 ms | 256 KB |
22.txt | AC | 4 ms | 256 KB |
23.txt | AC | 4 ms | 256 KB |
24.txt | AC | 4 ms | 256 KB |
25.txt | AC | 2 ms | 256 KB |
26.txt | WA | 3 ms | 256 KB |
27.txt | WA | 4 ms | 256 KB |
28.txt | WA | 4 ms | 256 KB |
29.txt | WA | 3 ms | 256 KB |
30.txt | AC | 4 ms | 256 KB |
31.txt | AC | 3 ms | 256 KB |
32.txt | WA | 4 ms | 256 KB |
33.txt | WA | 3 ms | 256 KB |
34.txt | WA | 3 ms | 256 KB |
sample_01.txt | WA | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |