結果
| 問題 |
No.3323 岩井星式ジャンケン
|
| コンテスト | |
| ユーザー |
UT0911
|
| 提出日時 | 2025-11-01 15:19:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,271 bytes |
| コンパイル時間 | 1,907 ms |
| コンパイル使用メモリ | 200,868 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-11-01 15:19:22 |
| 合計ジャッジ時間 | 3,475 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 19 WA * 7 |
ソースコード
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define COUT(num,len) cout << fixed << setprecision(len) << num;
#define iN int N; cin >> N;
#define lN ll N; cin >> N;
#define coutY cout << "Yes" << endl;
#define coutN cout << "No" << endl;
#define arrIn(arr, start, N) for (int i = (start); i < (N); ++i) cin >> arr[i];
#define arrOut(arr, start, N) for (int i = (start); i < (N); ++i) { cout << arr[i] <<" "; } cout << endl;
#define arrCopy(arr1,arr2, start, N) for (int i = (start); i < (N); ++i) arr2[i]= arr1[i];
void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); }
void YN(bool tf) { cout << (tf ? "YES\n" : "NO\n"); }
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string abc="abcdefghijklmnopqrstuvwxyz";
//cout << fixed << setprecision(20) <<
int gcd(int a, int b){ //最大公約数
if(a%b == 0){
return b;
}else{
return gcd(b, a%b);
}
}
int lcm(int a, int b){ //最小公倍数
return a*b / gcd(a, b);
}
int nibun(const std::vector<int>& arr, int key, int begin, int end) {
while (begin <= end) {
int mid = (begin + end) / 2;
if (arr[mid] == key) {
return mid;
} else if (arr[mid] < key) {
begin = mid + 1;
} else {
end = mid - 1;
}
}
return -1;
}
int fabs(int a,int b){
if(a-b>0){
return a-b;
}else{
return b-a;
}
}
int main() {
std::cin.tie(nullptr);
std::ios_base::sync_with_stdio(false);
ll N,M;
cin >> N >> M;
vector<string> S(N);
for(ll i=0;i<N;i++){
cin >> S[i];
}
string ans="";
ll G,C,P,GG,CC,PP;
vector<ll> win(N,0);
for(ll i=0;i<M;i++){
G=1;
C=1;
P=1;
for(ll j=0;j<N;j++){
if((S[j][i-1]=='G'&&ans[i-1]=='P')||(S[j][i-1]=='C'&&ans[i-1]=='G')||(S[j][i-1]=='P'&&ans[i-1]=='G')){
win[j]=1;
}else if(win[j]==0){
if(S[j][i]=='G'){
C=0;
}else if(S[j][i]=='C'){
P=0;
}else if(S[j][i]=='P'){
G=0;
}
}
if(G==0&&C==0&&P==0){
cout << -1 << endl;
return 0;
}
}
if(G==1){
ans+='G';
}else if(C==1){
ans+='C';
}else if(P==1){
ans+='P';
}
}
cout << ans << endl;
return 0;
}
UT0911