Submission #58384


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <bits/stdc++.h>
#define SIZE 505
using namespace std;
char S[SIZE][SIZE];
char T[SIZE][SIZE];
char nxt[SIZE][SIZE];
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%s",&S[i]);
for(int i=0;i<n;i++) scanf("%s",&T[i]);
int ret=n*n;
for(int i=0;i<4;i++)
{
int cnt=min(i,4-i);
for(int x=0;x<n;x++)
{
for(int y=0;y<n;y++)
{
if(S[x][y]!=T[x][y]) cnt++;
}
}
ret=min(ret,cnt);
for(int x=0;x<n;x++) for(int y=0;y<n;y++) nxt[y][n-x-1]=S[x][y];
for(int x=0;x<n;x++) for(int y=0;y<n;y++) S[x][y]=nxt[x][y];
}
printf("%d\n",ret);
return 0;
}

ステータス

項目 データ
問題 1265 - ポスター (Poster)
ユーザー名 syoribu
投稿日時 2020-02-03 15:52:03
言語 C++14
状態 Accepted
得点 100
ソースコード長 622 Byte
最大実行時間 42 ms
最大メモリ使用量 1400 KB

セット

セット 得点 Cases
1 ALL 100 / 100 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 42 ms 1372 KB
1
01-02.txt AC 24 ms 1372 KB
1
01-03.txt AC 30 ms 1368 KB
1
01-04.txt AC 30 ms 1240 KB
1
01-05.txt AC 19 ms 1364 KB
1
01-06.txt AC 25 ms 1236 KB
1
01-07.txt AC 21 ms 1140 KB
1
01-08.txt AC 21 ms 1192 KB
1
01-09.txt AC 18 ms 1236 KB
1
01-10.txt AC 28 ms 1252 KB
1
01-11.txt AC 24 ms 1148 KB
1
01-12.txt AC 21 ms 1204 KB
1
01-13.txt AC 23 ms 1208 KB
1
01-14.txt AC 26 ms 1400 KB
1
01-15.txt AC 26 ms 1148 KB
1
01-16.txt AC 20 ms 552 KB
1
01-17.txt AC 32 ms 636 KB
1
sample-01.txt AC 25 ms 596 KB
1
sample-02.txt AC 28 ms 556 KB
1
sample-03.txt AC 27 ms 652 KB
1