結果
| 問題 | No.3323 岩井星式ジャンケン |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-04 22:20:45 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,959 bytes |
| 記録 | |
| コンパイル時間 | 5,127 ms |
| コンパイル使用メモリ | 389,832 KB |
| 実行使用メモリ | 6,912 KB |
| 最終ジャッジ日時 | 2026-09-04 22:21:19 |
| 合計ジャッジ時間 | 7,879 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 6 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using mint = modint998244353;
// using mint = modint1000000007;
constexpr ll INF = (1LL << 60);
constexpr int INF32 = (1 << 30);
template<typename T> using vc = vector<T>;
template<typename T> using vv = vector<vector<T>>;
using vi = vc<int>;
using vvi = vv<int>;
using vl = vc<ll>;
using vvl = vv<ll>;
using vs = vc<string>;
using vvs = vv<string>;
using vb = vc<bool>;
using vvb = vv<bool>;
using vmint = vc<mint>;
using vvmint = vv<mint>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define drep(i,n) for(ll i=(ll)(n)-1; i>=0; i--)
#define rrep(i,n) for(ll i=1; i<=(ll)(n); i++)
#define nfor(i,a,b) for(ll i=(ll)(a); i<(ll)(b); i++)
#define dfor(i,a,b) for(ll i=(ll)(a)-1; i>=(ll)(b); i--)
#define nall(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
template<class T>
istream& operator>>(istream& is, vector<T>& v) {
for (auto& x : v) is >> x;
return is;
}
template<class T, class U>
istream& operator>>(istream& is, pair<T,U>& p) {
return is >> p.first >> p.second;
}
template<class T>
bool chmax(T& a, const T& b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template<class T>
bool chmin(T& a, const T& b) {
if (a > b) {
a = b;
return true;
}
return false;
}
void YES() { cout << "Yes\n"; }
void NO() { cout << "No\n"; }
void yn(bool ok) {
cout << (ok ? "Yes" : "No") << '\n';
}
template<class T>
void print(const vector<T>& v) {
for (int i = 0; i < (int)v.size(); i++) {
if (i) cout << ' ';
cout << v[i];
}
cout << '\n';
}
template<class T>
void print(const vector<vector<T>>& v) {
for (const auto& row : v) {
print(row);
}
}
void print(ld x) {
cout << fixed << setprecision(20) << x << '\n';
}
int main() {
int N, M;
cin >> N >> M;
vs S(N);
cin >> S;
vi beat(N,0);
string ans = "";
rep(i,M) {
int g = 0;
int p = 0;
int c = 0;
rep(j,N) {
if(beat[j]==1) continue;
if(S[j][i]=='G') g = 1;
if(S[j][i]=='P') p = 1;
if(S[j][i]=='C') c = 1;
}
if(g*p*c==1) {
cout << "-1\n";
return 0;
}
if(g==1&&p==1) ans.push_back('P');
else if(c==1&&p==1) ans.push_back('C');
else if(g==1&&c==1) ans.push_back('G');
else if(g==1) ans.push_back('P');
else if(c==1) ans.push_back('G');
else ans.push_back('C');
rep(j,N) {
if(ans.back()=='G' && S[j][i]=='C') beat[j] = 1;
if(ans.back()=='P' && S[j][i]=='G') beat[j] = 1;
if(ans.back()=='C' && S[j][i]=='P') beat[j] = 1;
}
}
cout << ans << "\n";
}