Submission #65443471


Source Code Expand

#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define REP(a,i,n) for (ll i=a;i<n;i++)

char T[101][101];
vector<vector<char> > newS(101, vector<char>(101));
ll mismatch(ll N) {
    ll count=0;
    REP(0, i, N) {
        REP(0, j, N) {
            count += (T[i][j]!=newS[i][j]);
        }
    }
    return count;
}

void turn(vector<vector<char> > &S, ll N) {
    vector<vector<char> > nS(101, vector<char>(101));
    REP(0, i, N) {
        REP(0, j, N) {
            nS[i][j] = S[N-j-1][i];
        }
    }
    S = nS;
}

int main() {
    ll N, mini = 101*101; cin >> N;
    REP(0, i, N) {
        REP(0, j, N) {
            cin >> newS[i][j];
        }
    }
    REP(0, i, N) {
        REP(0, j, N) {
            cin >> T[i][j];
        }
    }
    REP(0, i, 4) {
        mini = min(mini, mismatch(N)+i);
        turn(newS, N);
    }
    cout << mini;
    return 0;
}

Submission Info

Submission Time
Task B - Grid Rotation
User pensive
Language C++ 20 (gcc 12.2)
Score 250
Code Size 937 Byte
Status AC
Exec Time 2 ms
Memory 3604 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 3556 KiB
random_02.txt AC 1 ms 3516 KiB
random_03.txt AC 1 ms 3592 KiB
random_04.txt AC 1 ms 3528 KiB
random_05.txt AC 1 ms 3524 KiB
random_06.txt AC 1 ms 3556 KiB
random_07.txt AC 1 ms 3492 KiB
random_08.txt AC 1 ms 3536 KiB
random_09.txt AC 2 ms 3492 KiB
random_10.txt AC 2 ms 3532 KiB
random_11.txt AC 2 ms 3604 KiB
random_12.txt AC 2 ms 3528 KiB
random_13.txt AC 2 ms 3600 KiB
random_14.txt AC 2 ms 3400 KiB
random_15.txt AC 2 ms 3396 KiB
random_16.txt AC 2 ms 3404 KiB
random_17.txt AC 1 ms 3556 KiB
random_18.txt AC 1 ms 3472 KiB
random_19.txt AC 1 ms 3592 KiB
sample_01.txt AC 1 ms 3488 KiB
sample_02.txt AC 1 ms 3556 KiB