Submission #64049


ソースコード

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
66
67
68
69
70
71
72
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x) setprecision(x)
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin>>n;
vstring s(n);
vstring t(n);
rep(i,n){
cin>>s[i];
}
rep(i,n){
cin>>t[i];
}
int min=0;
rep(i,n){
rep(j,n){
if(s[i][j]!=t[i][j]){
min++;
}
}
}
int tmp=0;
rep(i,n){
rep(j,n){
if(s[j][n-i-1]!=t[i][j]){
tmp++;
}
}
}
tmp++;
chmin(min,tmp);
tmp=0;
rep(i,n){
rep(j,n){
if(s[n-i-1][n-j-1]!=t[i][j]){
tmp++;
}
}
}
tmp+=2;
chmin(min,tmp);
tmp=0;
rep(i,n){
rep(j,n){
if(s[n-j-1][i]!=t[i][j]){
tmp++;
}
}
}
tmp++;
chmin(min,tmp);
cout<<min<<'\n';
return(0);
}

ステータス

項目 データ
問題 1265 - ポスター (Poster)
ユーザー名 ei1918
投稿日時 2020-09-15 21:58:04
言語 C++14
状態 Accepted
得点 100
ソースコード長 1463 Byte
最大実行時間 31 ms
最大メモリ使用量 1160 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 30 ms 1116 KB
1
01-02.txt AC 22 ms 1160 KB
1
01-03.txt AC 25 ms 956 KB
1
01-04.txt AC 31 ms 1004 KB
1
01-05.txt AC 20 ms 1056 KB
1
01-06.txt AC 30 ms 972 KB
1
01-07.txt AC 26 ms 956 KB
1
01-08.txt AC 28 ms 1080 KB
1
01-09.txt AC 27 ms 1064 KB
1
01-10.txt AC 29 ms 1132 KB
1
01-11.txt AC 23 ms 972 KB
1
01-12.txt AC 26 ms 1100 KB
1
01-13.txt AC 20 ms 1028 KB
1
01-14.txt AC 20 ms 1040 KB
1
01-15.txt AC 17 ms 1104 KB
1
01-16.txt AC 19 ms 584 KB
1
01-17.txt AC 22 ms 540 KB
1
sample-01.txt AC 14 ms 624 KB
1
sample-02.txt AC 17 ms 708 KB
1
sample-03.txt AC 17 ms 664 KB
1