Please sign in first.
Submission #65426323
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define i128 __int128
#define ui unsigned int
#define ull unsigned long long
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());
const ull X=rng_64();
ull splitmix64(ull x) {
x^=x<<13;
x^=x>>7;
x^=x<<17;
return x;
}
ull rng(ull x){return splitmix64(x+X);}
const int N=100;
int n;
char a[N+10][N+10],b[N+10][N+10];
int calc(){
int res=0;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
res+=(a[i][j]!=b[i][j]);
return res;
}
char c[N+10][N+10];
void sol(){
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
c[j][n+1-i]=a[i][j];
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
a[i][j]=c[i][j];
}
int main(){
ios::sync_with_stdio(0),cin.tie(0);
cin>>n;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
cin>>a[i][j];
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
cin>>b[i][j];
int ans=1e9;
ans=min(ans,calc());
sol();
ans=min(ans,calc()+1);
sol();
ans=min(ans,calc()+2);
sol();
ans=min(ans,calc()+3);
sol();
cout<<ans<<'\n';
return 0;
}
/*
Cyber malody E judge fc choke.
g++ test.cpp -o test -std=c++14 -O2 -Wall -Wshadow ulimit -s 5120000
./test
*/
Submission Info
| Submission Time | |
|---|---|
| Task | B - Grid Rotation |
| User | BigPigeon_fan |
| Language | C++ 20 (gcc 12.2) |
| Score | 250 |
| Code Size | 1323 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3616 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 250 / 250 | ||||
| Status |
|
|
| 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 | 3408 KiB |
| random_02.txt | AC | 1 ms | 3556 KiB |
| random_03.txt | AC | 1 ms | 3348 KiB |
| random_04.txt | AC | 1 ms | 3500 KiB |
| random_05.txt | AC | 1 ms | 3472 KiB |
| random_06.txt | AC | 1 ms | 3348 KiB |
| random_07.txt | AC | 1 ms | 3492 KiB |
| random_08.txt | AC | 1 ms | 3504 KiB |
| random_09.txt | AC | 1 ms | 3560 KiB |
| random_10.txt | AC | 1 ms | 3616 KiB |
| random_11.txt | AC | 1 ms | 3500 KiB |
| random_12.txt | AC | 1 ms | 3564 KiB |
| random_13.txt | AC | 1 ms | 3496 KiB |
| random_14.txt | AC | 1 ms | 3520 KiB |
| random_15.txt | AC | 1 ms | 3516 KiB |
| random_16.txt | AC | 1 ms | 3512 KiB |
| random_17.txt | AC | 1 ms | 3484 KiB |
| random_18.txt | AC | 1 ms | 3472 KiB |
| random_19.txt | AC | 1 ms | 3448 KiB |
| sample_01.txt | AC | 1 ms | 3480 KiB |
| sample_02.txt | AC | 1 ms | 3480 KiB |