結果
問題 | No.2482 Sandglasses |
ユーザー |
![]() |
提出日時 | 2023-09-22 23:01:44 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 145 ms / 2,000 ms |
コード長 | 1,162 bytes |
コンパイル時間 | 6,801 ms |
コンパイル使用メモリ | 332,976 KB |
実行使用メモリ | 12,800 KB |
最終ジャッジ日時 | 2024-11-16 22:51:39 |
合計ジャッジ時間 | 12,819 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using i32 = int; using u32 = unsigned int; using i64 = long long; using u64 = unsigned long long; #define FAST_IO \ ios::sync_with_stdio(false); \ cin.tie(0); const i64 INF = 1001001001001001001; using Modint = atcoder::static_modint<998244353>; int main() { FAST_IO int n; cin >> n; i64 k, t; cin >> k >> t; vector a(n, string()); vector b(n, 0LL); vector c(n, pair<int, int>()); for (auto i : views::iota(0, n)) { cin >> a[i]; } for (auto i : views::iota(0, n)) { cin >> b[i]; c[i] = pair(i, b[i]); } ranges::sort(c, {}, [](pair<int, int> a) { return a.second; }); for (auto i : views::iota(0, n)) { if (a[i] == "A") { b[i] -= t; b[i] %= 2 * k; if (b[i] < 0) b[i] += 2 * k; } else { b[i] += t; b[i] %= 2 * k; } if (b[i] >= k) { b[i] = k - (b[i] - k); } } ranges::sort(b); for (auto i : views::iota(0, n)) { c[i].second = b[i]; } ranges::sort(c, {}, [](auto a) { return a.first; }); for (auto v : c) { cout << v.second << " "; } cout << endl; }