結果
| 問題 |
No.3323 岩井星式ジャンケン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-01 15:07:27 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,723 bytes |
| コンパイル時間 | 3,774 ms |
| コンパイル使用メモリ | 286,640 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-11-01 15:07:33 |
| 合計ジャッジ時間 | 4,643 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 6 |
ソースコード
#include <bits/stdc++.h>
#include <cstdlib>
#include <math.h>
using namespace std;
using ll = long long;
int main(){
int n,m;
cin >> n >> m;
vector<string>s(n);
for(int i=0;i<n;i++){
cin >> s[i];
}
string ans;
vector<bool>r(n,true);
for(int i=0;i<m;i++){
set<char>c;
for(int j=0;j<n;j++){
if(!r[j])continue;
c.insert(s[j][i]);
}
if(c.size()==3){
cout << -1 << endl;
return 0;
}else if(c.size()==2){
if(!c.count('G')){
ans.push_back('C');
for(int j=0;j<n;j++){
if(s[j][i]=='P')r[j]=false;
}
}
if(!c.count('C')){
ans.push_back('P');
for(int j=0;j<n;j++){
if(s[j][i]=='G')r[j]=false;
}
}
if(!c.count('P')){
ans.push_back('G');
for(int j=0;j<n;j++){
if(s[j][i]=='C')r[j]=false;
}
}
}else if(c.size()==1){
if(c.count('G')){
ans.push_back('P');
for(int j=0;j<n;j++){
r[j]=false;
}
}
if(c.count('C')){
ans.push_back('G');
for(int j=0;j<n;j++){
r[j]=false;
}
}
if(c.count('P')){
ans.push_back('C');
for(int j=0;j<n;j++){
r[j]=false;
}
}
}else{
ans.push_back('G');
}
}
cout << ans << endl;
return 0;
}