結果
問題 | No.2042 RGB Caps |
ユーザー | kotatsugame |
提出日時 | 2022-08-19 21:26:58 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 702 bytes |
コンパイル時間 | 564 ms |
コンパイル使用メモリ | 65,528 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-04-17 00:07:21 |
合計ジャッジ時間 | 3,366 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 3 ms
5,376 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
ソースコード
#include<iostream> using namespace std; int N,K; char A[1<<17]; int main() { cin>>N>>K; for(int i=1;i<=N;i++)A[i]='R'; for(int i=0;i<K;i++) { int a;cin>>a; cin>>A[a]; } string ans=""; for(int i=1;i<=N;i+=3) { ans+=A[i]; if(i+2<=N) { if(A[i]==A[i+1]) { if(A[i]==A[i+2]) { if(A[i]=='R')ans+="GB"; else if(A[i]=='G')ans+="RB"; else ans+="RG"; } else { ans+=A[i+2]; ans+='R'^'G'^'B'^A[i]^A[i+2]; } } else { if(A[i]==A[i+2]) { ans+=A[i+1]; ans+='R'^'G'^'B'^A[i]^A[i+1]; } else { ans+=A[i+1]; ans+=A[i+2]; } } } else if(i+1<=N) { ans+=A[i+1]; } } cout<<ans<<endl; }