Problem:
A: 間違い探し
問題
縦に
N
マス、横に
M
マスある長方形の盤面
A
,
B
が与えられます。各盤面について、それぞれのマスは白または黒で塗られています。
盤面
X
の
i
行
j
列目のマスの色を
C(i, j, X)
と表記することにします。
以下の条件を満たす整数の組
(i, j)
がいくつあるか数えてください。
1 \leq i \leq N
1 \leq j \leq M
C(i, j, A) \neq C(i, j, B)
入力形式
N
M
A_1
...
A_N
B_1
...
B_N
A_i
(
1 \leq i \leq N
) の
j
文字目が
#
のときは
C(i, j, A)
が黒、
.
のときは
C(i, j, A)
が白であることを表します。
B
についても同様です。
制約
1 \leq N, M \leq 2,000
|A_i| = |B_i| = M
A_i
,
B_i
は
#
と
.
のみからなる文字列
出力形式
答えを一行に出力してください。
入力例1
2 3
..#
##.
.##
#..
出力例1
2
入力例2
7 28
............................
...#.....###...####....###..
..#.#...#...#..#...#..#...#.
.#...#..#......####...#.....
.#####..#...#..#......#...#.
.#...#...###...#.......###..
............................
............................
..###....###.....##....###..
.#...#..#...#...#.#...#...#.
...##...#...#.....#....####.
..#.....#...#.....#.......#.
.#####...###....####...###..
............................
出力例2
40

Submitted solutions:

code_snippet: #include <bits/stdc++.h>


using namespace std;
//make -f ../makefile SRC=
/*
*/


//------------------------------------------------------------------------------
bool DEBUG = false;
const int INF = 1000000000;

const int MAX_N = 10;
static int vect[MAX_N];

//------------------------------------------------------------------------------
void solve(int N)
{
    //--------------------------------------------------------------------------
    // base cases:
    //--------------------------------------------------------------------------
    // init:
    //sort(vect, vect+N);
    //memset(S0, 0L, sizeof(S0));
    //--------------------------------------------------------------------------
    // compute:
    

    //--------------------------------------------------------------------------
    
    //--------------------------------------------------------------------------
    // report:
    //printf("%d\n", res);


}

//------------------------------------------------------------------------------
void test()
{

}

//------------------------------------------------------------------------------
int main()
{
    //test(); return 0;
    //DEBUG = true;
    //--------------------------------------------------------------------------
    int M, N, num;
    char c;
    cin >> M >> N;
    vector<bool> S(M*N, false);
    for (int v=0; v<M*N; ++v)
    {
        cin >> c;
        if (c == '.') S[v] = true;
    }

    int res = 0;
    for (int v=0; v<M*N; ++v)
    {
        cin >> c;
        if ((c == '.' && !S[v]) || (c == '#' && S[v])) res++;
    }
    printf("%d\n", res);
    //--------------------------------------------------------------------------
    return 0;
}
//------------------------------------------------------------------------------
accuracy: 1
time_ms: 230
memory_kb: 3552
final_rank: 5

code_snippet: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using ll = long long;
using P = pair<int,int>;
const int mod=998244353;
const int inf = (1<<30);

const int dy[4] = {-1,0,0,1};
const int dx[4] = {0,-1,1,0};

int main() {
    int n,m; cin>>n>>m;
    vector<vector<char>> a(n,vector<char>(m));
    rep(i,n)rep(j,m){
        cin>>a[i][j];
    }
    int ans = 0;
    rep(i,n){
        rep(j,m){
            char b; cin>>b;
            if(a[i][j] != b) ans++;
        }
    }
    cout<<ans<<endl;



}
accuracy: 1
time_ms: 190
memory_kb: 7436
final_rank: 6

code_snippet: #include<bits/stdc++.h>
using namespace std;

int main(){    
    int N, M; cin >> N >> M;
    vector A(N, vector<char>(M)), B(N, vector<char>(M));
    for (auto& a : A) for (auto& x : a) cin >> x;
    for (auto& a : B) for (auto& x : a) cin >> x;
    int ans = 0;
    for (int i = 0 ; i < N ; i++) {
        for (int j = 0 ; j < M ; j++) {
            ans += A[i][j] != B[i][j];
        }
    }
    cout << ans << endl;
}
accuracy: 1
time_ms: 170
memory_kb: 11416
final_rank: 14

code_snippet: #include<bits/stdc++.h>

using namespace std;

int main(){
  int h;
  int w;
  cin >> h >> w;
  vector<vector<int>> table(h,vector<int>(w,0));
  for(auto &i:table)for(auto &j:i){
    char v;
    cin >> v;
    j += v;
  }
  for(auto &i:table)for(auto &j:i){
    char v;
    cin >> v;
    j -= v;
  }
  int ans  = 0;
  for(auto &i:table)for(auto &j:i)if(j)++ans;
  cout << ans << endl;
}
accuracy: 1
time_ms: 190
memory_kb: 18960
final_rank: 20

code_snippet: #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using std::cout;
using std::cin;
using std::endl;
using ll=long long;
using ld=long double;
ll ILL=2167167167167167167;
const int INF=2100000000;
const ll mod=998244353;
#define rep(i,a) for (ll i=0;i<a;i++)
#define all(p) p.begin(),p.end()
template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> ll LB(vector<T> &v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> ll UB(vector<T> &v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}else return 0;}
template<class T> void So(vector<T> &v) {sort(v.begin(),v.end());}
template<class T> void Sore(vector<T> &v) {sort(v.begin(),v.end(),[](T x,T y){return x>y;});}
void yneos(bool a){if(a) cout<<"Yes\n"; else cout<<"No\n";}
template<class T> void vec_out(vector<T> &p){for(int i=0;i<(int)(p.size());i++){if(i) cout<<" ";cout<<p[i];}cout<<"\n";}
template<class T> T min(vector<T> &a){assert(!a.empty());T ans=a[0];for(auto &x:a) chmin(ans,x);return ans;}
template<class T> T max(vector<T> &a){assert(!a.empty());T ans=a[0];for(auto &x:a) chmax(ans,x);return ans;}



void solve();
// oddloop
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int t=1;
	//cin>>t;
	rep(i,t) solve();
}

void solve(){
	int N,M,ans=0;
	cin>>N>>M;
	vector<char> p(N*M);
	rep(i,N*M) cin>>p[i];
	rep(i,N*M){
		char c;
		cin>>c;
		ans+=(c!=p[i]);
	}
	cout<<ans<<"\n";
}
accuracy: 1
time_ms: 50
memory_kb: 6968
final_rank: 2

code_snippet: #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b){ if (a < b){ a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b){ if (a > b){ a = b; return true; } return false; }


int main() {
    int n, m; cin >> n >> m;
    vector<string> a(n), b(n);
    for(int i=0; i<n; ++i) cin >> a[i];
    for(int i=0; i<n; ++i) cin >> b[i];
    int ans = 0;
    for(int i=0; i<n; ++i)
        for(int j=0; j<m; ++j)
            ans += int(a[i][j] != b[i][j]);
    cout << ans << endl;
}
accuracy: 1
time_ms: 90
memory_kb: 18636
final_rank: 16

code_snippet: #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    vector<string> A(N),B(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    for(int i=0; i<N; i++){
        cin >> B[i];
    }
    int cnt = 0;
    for(int i=0; i<N; i++){
        for(int j=0; j<M; j++){
            if(A[i][j] != B[i][j]) cnt++;
        }
    }
    cout << cnt << "\n";
    return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 11344
final_rank: 4

code_snippet: #include<bits/stdc++.h>
using namespace std;

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n,m;cin>>n>>m;
  vector<vector<char>> a(n,vector<char>(m));
  int i,j;
  rep(i,n)rep(j,m)cin>>a[i][j];
  vector<vector<char>> b(n,vector<char>(m));
  rep(i,n)rep(j,m)cin>>b[i][j];
  int ans=0;
  rep(i,n)rep(j,m)
  {
    if(a[i][j]!=b[i][j])ans++;
  }
  cout<<ans<<endl;
}
accuracy: 1
time_ms: 330
memory_kb: 10760
final_rank: 19

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for (ll i = 0, i##_len = (n); i < i##_len; i++)

int main() {

    ll n, m; cin >> n >> m;
    vector<string> a(n), b(n);
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> b[i];
    ll ans = 0;
    REP(i, n) REP(j, m) ans += a[i][j] != b[i][j];
    cout << ans << endl;

}
accuracy: 1
time_ms: 170
memory_kb: 11132
final_rank: 11

code_snippet: #include <bits/stdc++.h>
using namespace std;

int main() {
  int n,m,ans=0;
  cin >> n >> m;

  vector<string>table_a(n);
  vector<string>table_b(n);

  for (int i = 0; i < n; i++) {
    cin >> table_a.at(i);
  }

  for (int i = 0; i < n; i++) {
    cin >> table_b.at(i);
  }  

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (table_a.at(i).at(j) != table_b.at(i).at(j)) {
        ans++;
      }
    } 
  }
  cout << ans << endl;
}
accuracy: 1
time_ms: 170
memory_kb: 11132
final_rank: 11

code_snippet: #include <iostream>
#include <vector>
using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  vector<string> A(N), B(N);
  for(int i = 0; i < N; ++i)
    cin >> A[i];
  for(int i = 0; i < N; ++i)
    cin >> B[i];
  int ans = 0;
  for(int i = 0; i < N; ++i)
    for(int j = 0; j < M; ++j)
      ans += (A[i][j] != B[i][j]);
  cout << ans << endl;
}
accuracy: 1
time_ms: 170
memory_kb: 11056
final_rank: 7

code_snippet: #include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int n, m; 
	int a, b, c, d, e;
	string s, t;
	
	char c1, c2, c3;
	
	static int x[1000] = {};
	static int y[1000] = {};
	
	vector<int> v, u;
	pair<int,int> p;
	
	int r[30] = {};
	
	
	int N, M;
	
	cin>>N>>M;
	
	vector<string> A(N), B(N);
	
	
	for(int i = 0; i < N; i++){
		cin>>A[i];
	}
	
	for(int i = 0; i < N; i++){
		cin>>B[i];
	}
	
	int con = 0;
	
	for(int i = 0; i < N; i++){
		for(int j = 0; j < M ;j++){
			if(A[i][j] != B[i][j]) con++;
		}
	}
	
	cout<<con<<endl;
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 11260
final_rank: 3

code_snippet: #include<iostream>
using namespace std;

char a[2010][2010];

int main(){
    
    int n,m,ans;
    char b;
    
    cin >> n >> m;
    for(int i=0;i<n;i++) cin >> a[i];
    ans = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> b;
            ans += b!=a[i][j];
        }
    }
    cout << ans << endl;
    
    return(0);
}
accuracy: 1
time_ms: 330
memory_kb: 6940
final_rank: 15

code_snippet: #include <bits/stdc++.h>
using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    string S[2][2000];
    for(int t=0; t<2; t++) for(int i=0; i<N; i++) cin >> S[t][i];
    int ans = 0;
    for(int i=0; i<N; i++) for(int j=0; j<M; j++) if(S[0][i][j] != S[1][i][j]) ans++;
    cout << ans << endl;
    return 0;
}
accuracy: 1
time_ms: 170
memory_kb: 11264
final_rank: 13

code_snippet: #include<iostream>
#include<string>
#include<vector>
using namespace std;

int main(){
  int n,m;
  vector<string> Amap;
  vector<string> Bmap;
  cin >> n >> m;
  for(int i=0; i<n; ++i){
    string tmp;
    cin >> tmp;
    Amap.push_back(tmp);
  }
  
  for(int i=0; i<n; ++i){
    string tmp;
    cin >> tmp;
    Bmap.push_back(tmp);
  }
  int sum = 0;
  for(int i=0; i<n; ++i){
    for(int j=0; j<m; ++j){
      if(Amap[i][j] != Bmap[i][j])++sum;
    }
  }
  cout << sum << endl;
}
accuracy: 1
time_ms: 170
memory_kb: 11124
final_rank: 10

code_snippet: #include<bits/stdc++.h>
using namespace std;

int main()
{ 
  vector<string> A;
  vector<string> B;
  int N,M;
  cin>>N>>M;

  for(int i = 0;i < N;++i){
    string temp;
    cin>>temp;
    A.push_back(temp);
  }
  for(int i = 0;i < N;++i){
    string temp;
    cin>>temp;
    B.push_back(temp);
  }

  int ans = 0;
  for(int i = 0;i < N;++i){
    string a = A.at(i);
    string b = B.at(i);

    for(int j = 0;j < M;++j){
      char a2 = a[j];
      char b2 = b[j];

      if(a2 != b2){
        ++ans;
      }
    }
  }
  cout<<ans<<endl;

  return 0;
}
accuracy: 1
time_ms: 170
memory_kb: 11100
final_rank: 8

code_snippet: #include <iostream>
#include <vector>
using namespace std;

int main() {
  int N, M;
  int ans = 0;
  cin >> N >> M;

  vector<vector<char>> A(2001, vector<char>(2001));
  vector<vector<char>> B(2001, vector<char>(2001));

  for(int i = 0; i < N; i++) {
    for(int j = 0; j < M; j++) {
      cin >> A[i][j];
    }
  }

  for(int i = 0; i < N; i++) {
    for(int j = 0; j < M; j++) {
      cin >> B[i][j];
    }
  }

 for(int i = 0; i < N; i++) {
    for(int j = 0; j < M; j++) {
      if(A[i][j] != B[i][j])
        ans++;
    }
  }

 cout << ans <<	endl;

  return 0;
}
accuracy: 1
time_ms: 310
memory_kb: 10796
final_rank: 18

code_snippet: #include <cstdio>

using namespace std;

char board[2000][2000];
int N,M;

int main(){
    scanf("%d%d\n",&N,&M);

    for (int i=0;i<N;i++){
        for (int j=0;j<M;j++){
            board[i][j]=getchar();
        }
        getchar();
    }
    int count=0;
    for (int i=0;i<N;i++){
        for (int j=0;j<M;j++){
            if (board[i][j]!=getchar())
                count++;
        }
        getchar();
    }

    printf("%d\n",count);

    return 0;
}
accuracy: 1
time_ms: 40
memory_kb: 6656
final_rank: 1

code_snippet: #include<bits/stdc++.h>

using namespace std;

int main(){

  int N,M;

  cin >> N >> M;
  
  char A[N][M];
  char B[N][M];

  int total = 0;
  
  for(int i = 0;i < N;++i){
    for(int j = 0;j < M;++j){
      cin >> A[i][j];
    }
  }
  
  for(int i = 0;i < N;++i){
    for(int j = 0;j < M;++j){
      cin >> B[i][j];
      if(A[i][j] != B[i][j])
	total++;
    }
  }

  cout << total << endl;
  
}
accuracy: 1
time_ms: 290
memory_kb: 10900
final_rank: 17

code_snippet: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n,m;
    cin >> n >> m;
    vs a(n),b(n);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    int ans = 0;
    rep(i,n)rep(j,m)if(a[i][j] != b[i][j])ans++;
    cout << ans << endl;
}
accuracy: 1
time_ms: 170
memory_kb: 11104
final_rank: 9