Submission #65429059


Source Code Expand

#include <iostream>
#define ll long long
#define R(a,b,c) for(ll a=b;a<=c;a++)
using namespace std;
char s[125][125];
char t[125][125];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<n;i++)cin>>t[i];
    int ans=1e9;
    int m=n-1;
    R(k,0,3){
        int cur=k;
        R(i,0,n){
            R(j,0,n){
                char c;
                if(k==0)c=s[i][j];
                else if(k==1)c=s[m-j][i];
                else if(k==2)c=s[m-i][m-j];
                else c=s[j][m-i];
                if(c!=t[i][j])cur++;
            }
        }
        ans=min(ans,cur);
    }
    cout<<ans<<'\n';
    return 0;
}

Submission Info

Submission Time
Task B - Grid Rotation
User Genius_Star
Language C++ 17 (gcc 12.2)
Score 250
Code Size 748 Byte
Status AC
Exec Time 1 ms
Memory 3628 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 2
AC × 21
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
random_01.txt AC 1 ms 3476 KiB
random_02.txt AC 1 ms 3480 KiB
random_03.txt AC 1 ms 3400 KiB
random_04.txt AC 1 ms 3480 KiB
random_05.txt AC 1 ms 3416 KiB
random_06.txt AC 1 ms 3396 KiB
random_07.txt AC 1 ms 3400 KiB
random_08.txt AC 1 ms 3428 KiB
random_09.txt AC 1 ms 3420 KiB
random_10.txt AC 1 ms 3628 KiB
random_11.txt AC 1 ms 3492 KiB
random_12.txt AC 1 ms 3628 KiB
random_13.txt AC 1 ms 3496 KiB
random_14.txt AC 1 ms 3540 KiB
random_15.txt AC 1 ms 3488 KiB
random_16.txt AC 1 ms 3556 KiB
random_17.txt AC 1 ms 3468 KiB
random_18.txt AC 1 ms 3528 KiB
random_19.txt AC 1 ms 3404 KiB
sample_01.txt AC 1 ms 3532 KiB
sample_02.txt AC 1 ms 3476 KiB