結果
| 問題 |
No.1954 CHECKER×CHECKER(2)
|
| コンテスト | |
| ユーザー |
renren_uts
|
| 提出日時 | 2022-06-16 21:54:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 231 ms / 1,000 ms |
| コード長 | 1,446 bytes |
| コンパイル時間 | 1,188 ms |
| コンパイル使用メモリ | 114,036 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-07 05:05:34 |
| 合計ジャッジ時間 | 4,116 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <tuple>
#include <bitset>
#include <map>
#include <queue>
#include <time.h>
#include <utility>
#include <numeric>
#include <deque>
#include <cassert>
#include <sstream>
#include <cctype>
#include <unordered_map>
#include <algorithm>
#include <chrono>
#define ll long long
#include <time.h>
#define mod % 998244353
#define rep(i,n) for(long long i = 0;i < n;i ++)
ll MAX = 5'000'000'000'000'000'000LL;
using namespace std;
int main(){
ll h,w;
cin >> h >> w;
vector<string> S(h);
rep(i,h)cin >> S[i];
vector<vector<ll>> a(h,vector<ll>(w,1));
rep(i,h){
rep(j,w){
if(S[0][0] == S[i][j])a[i][j] = 0;
}
}
vector<vector<ll>> b(h,vector<ll>(w,0));
rep(i,h){
rep(j,w){
ll s = 0;
rep(k,i+1){
rep(l,j+1){
s += b[k][l];
}
}
if(s%2!=a[i][j])b[i][j] = 1;
}
}
rep(i,h-1){
rep(j,w-1){
if(b[i+1][j+1]==1){
cout << "No" << endl;
return 0;
}
}
}
ll m;
cin >> m;
map<vector<ll>,ll> mp;
rep(i,m){
ll a,b;
cin >> a >> b;
mp[{a,b-1}] = 1;
}
rep(i,h-1){
if(b[i+1][0] == 0){
if(mp[{1,i}] == 0){
cout << "No" << endl;
return 0;
}
}
}
rep(i,w-1){
if(b[0][i+1] == 0 and mp[{2,i}] == 0){
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
return 0;
}
renren_uts