結果
| 問題 |
No.2042 RGB Caps
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-13 23:09:29 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 581 bytes |
| コンパイル時間 | 940 ms |
| コンパイル使用メモリ | 74,704 KB |
| 最終ジャッジ日時 | 2025-02-09 11:08:58 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 2 WA * 14 |
ソースコード
#include <algorithm>
#include <iostream>
using namespace std;
typedef pair<int, char> P;
int main()
{
int n, k;
cin >> n >> k;
P p[200005];
for (int i = 0; i < k; i++)
{
cin >> p[i].first >> p[i].second;
}
sort(p, p + k);
int d[3]{0};
string ans;
for (int i = 0; i < k; i++)
{
while (d[(int)p[i].second % 3] < (p[i].first + 2) / 3)
{
ans += p[i].second;
d[(int)p[i].second % 3]++;
}
}
while ((int)ans.size() < n)
{
ans += 'R';
}
cout << ans << endl;
}