結果
| 問題 | 
                            No.351 市松スライドパズル
                             | 
                    
| コンテスト | |
| ユーザー | 
                             vjudge1
                         | 
                    
| 提出日時 | 2025-03-17 20:56:20 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 563 bytes | 
| コンパイル時間 | 1,956 ms | 
| コンパイル使用メモリ | 192,412 KB | 
| 実行使用メモリ | 7,328 KB | 
| 最終ジャッジ日時 | 2025-03-17 20:56:27 | 
| 合計ジャッジ時間 | 6,946 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 4 | 
| other | RE * 17 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |         freopen("puzzle.in","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
main.cpp:27:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |         freopen("puzzle.out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1000010;
int n,m,q;
int row[N],col[N];
void solve(){
	cin>>n>>m>>q;
	while(q--){
		string op;
		cin>>op;
		int x;
		cin>>x;
		if(op=="R")row[x]--;
		else col[x]--;
	}
	int idx=(row[0]%n+n)%n;
	int idy=(col[0]%m+m)%m;
	if(idx%2==idy%2)cout<<"white\n";
	else cout<<"black\n";
	for(int i=0;i<n;i++)row[i]=0;
	for(int i=0;i<m;i++)col[i]=0;
	return;
}
signed main(){
	freopen("puzzle.in","r",stdin);
	freopen("puzzle.out","w",stdout);
	int T=1;
	cin>>T;
	while(T--)solve(); 
	return 0;
}
            
            
            
        
            
vjudge1