結果
| 問題 |
No.2042 RGB Caps
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-11-05 16:15:43 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 956 bytes |
| コンパイル時間 | 3,002 ms |
| コンパイル使用メモリ | 283,688 KB |
| 実行使用メモリ | 7,724 KB |
| 最終ジャッジ日時 | 2025-11-05 16:15:59 |
| 合計ジャッジ時間 | 14,990 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 3 WA * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define nl "\n"
#define vi vector<int>
#define ip(x) \
for (auto &it : x) \
cin >> it
#define all(x) x.begin(), x.end()
void solve()
{
int n, k;
cin >> n >> k;
vector<pair<int, char>> a(k);
for (auto &x : a)
{
cin >> x.first >> x.second;
}
sort(a.begin(), a.end(), [&](pair<int, char> a, pair<int, char> b)
{ return a.first > b.first; });
string ans(n, a[0].second);
for (int i = 1; i < k; i++)
{
int x = a[i].first;
int need = (x + 1) / 2;
for (int j = 0; j < need; j++)
{
ans[x - j] = a[i].second;
}
}
cout << ans << nl;
// for (auto x : a)
// {
// cout << x.first << " " << x.second << nl;
// }
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t = 1;
// cin >> t;
while (t--)
solve();
}
vjudge1