Submission #58487


ソースコード

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7;
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
char s[505][505],t[505][505];
int n;
cin >> n;
reps(i,n){
reps(j,n){
cin>>s[i][j];
}
}
reps(i,n){
reps(j,n){
cin >> t[i][j];
}
}
int a=0,b=0,c=0,d=0;
reps(i,n){
reps(j,n){
if(s[i][j] != t[i][j]){
a++;
}
if(s[i][j] != t[n-j+1][i]){
b++;
}
if(s[i][j] != t[j][n-i+1]){
c++;
}
if(s[i][j] != t[n-i+1][n-j+1]){
d++;
}
}
}
cout<<min(a,min(b+1,min(c+1,d+2)))<<'\n';
return 0;
}

ステータス

項目 データ
問題 1265 - ポスター (Poster)
ユーザー名 NASSUN_ei1906
投稿日時 2020-02-05 17:43:48
言語 C++14
状態 Accepted
得点 100
ソースコード長 1265 Byte
最大実行時間 32 ms
最大メモリ使用量 1212 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 32 ms 1116 KB
1
01-02.txt AC 24 ms 1212 KB
1
01-03.txt AC 27 ms 1060 KB
1
01-04.txt AC 25 ms 1164 KB
1
01-05.txt AC 25 ms 1132 KB
1
01-06.txt AC 29 ms 1104 KB
1
01-07.txt AC 26 ms 968 KB
1
01-08.txt AC 26 ms 972 KB
1
01-09.txt AC 30 ms 972 KB
1
01-10.txt AC 27 ms 1076 KB
1
01-11.txt AC 21 ms 932 KB
1
01-12.txt AC 19 ms 1064 KB
1
01-13.txt AC 28 ms 1044 KB
1
01-14.txt AC 22 ms 1052 KB
1
01-15.txt AC 23 ms 1024 KB
1
01-16.txt AC 29 ms 512 KB
1
01-17.txt AC 18 ms 712 KB
1
sample-01.txt AC 24 ms 660 KB
1
sample-02.txt AC 24 ms 728 KB
1
sample-03.txt AC 16 ms 672 KB
1