Submission #00016
ソースコード
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 | #include<bits/stdc++.h> using namespace std; int main(){ int n;cin>>n; string s[n]; for ( int i=0;i<n;i++){ cin>>s[i]; } string t[n]; for ( int i=0;i<n;i++){ cin>>t[i]; } int c=0,mi=INT_MAX; for ( int i=0;i<n;i++){ for ( int j=0;j<n;j++){ if (s[i][j]!=t[i][j])c++; } } mi=min(mi,c); c=1; for ( int i=0;i<n;i++){ for ( int j=n-1,k=0;j>=0,k<n;j--,k++){ if (s[j][i]!=t[i][k])c++; } } mi=min(mi,c); c=1; for ( int i=n-1,l=0;i>=0,l<n;i--,l++){ for ( int j=0;j<n;j++){ if (s[j][i]!=t[l][j])c++; } } mi=min(mi,c); c=2; for ( int i=n-1,l=0;l<n,i>=0;i--,l++){ for ( int j=n-1,k=0;j>=0,k<n;j--,k++){ if (s[i][j]!=t[l][k])c++; } } mi=min(mi,c); cout<<mi<< "\n" ; } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - ポスター |
ユーザー名 | ei2331 |
投稿日時 | 2023-11-13 16:33:55 |
言語 | C++17 |
状態 | Accepted |
得点 | 20 |
ソースコード長 | 892 Byte |
最大実行時間 | 39 ms |
最大メモリ使用量 | 1548 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | all | 20 / 20 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
01-01.txt | AC | 32 ms | 1372 KB |
1
|
01-02.txt | AC | 32 ms | 1520 KB |
1
|
01-03.txt | AC | 31 ms | 1408 KB |
1
|
01-04.txt | AC | 29 ms | 1548 KB |
1
|
01-05.txt | AC | 32 ms | 1444 KB |
1
|
01-06.txt | AC | 29 ms | 820 KB |
1
|
01-07.txt | AC | 30 ms | 948 KB |
1
|
01-08.txt | AC | 29 ms | 836 KB |
1
|
01-09.txt | AC | 28 ms | 1364 KB |
1
|
01-10.txt | AC | 39 ms | 888 KB |
1
|
01-11.txt | AC | 30 ms | 884 KB |
1
|
01-12.txt | AC | 26 ms | 1408 KB |
1
|
01-13.txt | AC | 29 ms | 932 KB |
1
|
01-14.txt | AC | 28 ms | 1340 KB |
1
|
01-15.txt | AC | 25 ms | 996 KB |
1
|
01-16.txt | AC | 24 ms | 492 KB |
1
|
01-17.txt | AC | 34 ms | 460 KB |
1
|
sample-01.txt | AC | 21 ms | 560 KB |
1
|
sample-02.txt | AC | 20 ms | 532 KB |
1
|
sample-03.txt | AC | 16 ms | 504 KB |
1
|