結果
問題 | No.2482 Sandglasses |
ユーザー |
|
提出日時 | 2023-09-22 21:58:44 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 98 ms / 2,000 ms |
コード長 | 1,392 bytes |
コンパイル時間 | 3,784 ms |
コンパイル使用メモリ | 263,204 KB |
実行使用メモリ | 6,528 KB |
最終ジャッジ日時 | 2024-11-16 22:46:43 |
合計ジャッジ時間 | 9,464 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> // #include <x86intrin.h> using namespace std; using namespace numbers; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ios::failbit); int n, k, t; cin >> n >> k >> t, t %= 2 * k; vector<char> a(n); vector<int> b(n); copy_n(istream_iterator<char>(cin), n, a.begin()); copy_n(istream_iterator<int>(cin), n, b.begin()); vector<int> order(n); iota(order.begin(), order.end(), 0); ranges::sort(order, [&](int i, int j){ return b[i] < b[j]; }); vector<int> res(n, -1); { vector<int> amount(n); for(auto i = 0; i < n; ++ i){ int d = a[i] == 'A' ? -1 : 1; long long x = b[i] + t * d; if(x < 0){ x += 2 * k; } x %= 2 * k; if(x >= k){ x = 2 * k - x; } amount[i] = x; } ranges::sort(amount); for(auto i = 0; i < n; ++ i){ res[order[i]] = amount[i]; } } ranges::copy(res, ostream_iterator<int>(cout, " ")); cout << "\n"; return 0; } /* */ //////////////////////////////////////////////////////////////////////////////////////// // // // Coded by Aeren // // // ////////////////////////////////////////////////////////////////////////////////////////