結果
| 問題 | 
                            No.819 Enjapma game
                             | 
                    
| コンテスト | |
| ユーザー | 
                             yyyuuuummmmaaa1
                         | 
                    
| 提出日時 | 2019-07-24 05:17:37 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,703 bytes | 
| コンパイル時間 | 1,811 ms | 
| コンパイル使用メモリ | 179,836 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-27 05:07:31 | 
| 合計ジャッジ時間 | 3,066 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 WA * 11 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>solve2(const vector<int>&v,int from){
	vector<int>que;
	map<int,int>mp;
	for(int x=from;x<v.size();++x){
		if(mp.find(v[x])==mp.end()){
			que.emplace_back(v[x]);
			mp[v[x]]=que.size()-1;
		}else{
			while(true){
				int aback=que.back();
				
				mp.erase(aback);
				que.pop_back();
				if(aback==v[x])break;
			}
		}
	}
	return que;
}
vector<int> solve(int N,long long int K,vector<int>v,int start){
	
	vector<int>rs(N);
	{
		map<int,int>mp;
		for(int i=N-1;i>=0;--i){
			mp[v[i]]=N+i;
		}
		for(int i=N-1;i>=0;--i){
			rs[i]=mp[v[i]];
			mp[v[i]]=i;
		}
	}
	
	long long int ny=0,nx=start;
	map<int,long long int>mp;
	mp[start]=0;
	while(true){
		//cout<<nx<<ny<<endl;
		auto next_x=rs[nx];
		long long next_y=ny;
		//cout<<next_x<<' '<<next_y<<endl;
		if(next_x>=N){
			next_y++;
			next_x-=N;
		}
		next_x++;
		if(next_x>=N){
			next_y++;
			next_x-=N;
		}
		if(next_y>=K){
			
			if(K-1==next_y){
				v.insert(v.end(),v.begin(),v.end());
			}
			return solve2(v,nx);
		}else{
			ny=next_y;
			nx=next_x;
			if(mp.find(nx)==mp.end()){
				mp[nx]=ny;
			}else{
				long long sa=-(mp[nx]-ny);
				long long int rest=K-ny;
				rest%=sa;
				//cout<<rest<<endl;
				if(rest==0)rest=sa;
				long long xx=K%sa;
				if(xx==0)xx=sa;
				assert(nx==0);
				return solve(N,xx,v,0);
			}
		}
	}
	assert(false);
	
}
#define WHATS(var) cout<<#var<<"="<<var<<endl;
int main() {
	ios::sync_with_stdio(false);
	int H,W;cin>>H>>W;
	int sum=0;
	for(int i=0;i<H;++i){
		string st;cin>>st;
		for(int j=0;j<W;++j){
			if(st[j]=='o')sum^=(i+j)%2+1;
		}
	}
	if(!(sum==1||sum==2))cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}	
            
            
            
        
            
yyyuuuummmmaaa1