結果

問題 No.2482 Sandglasses
ユーザー suisensuisen
提出日時 2023-09-22 23:43:23
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 753 bytes
コンパイル時間 927 ms
コンパイル使用メモリ 84,656 KB
実行使用メモリ 6,784 KB
最終ジャッジ日時 2024-11-16 22:52:46
合計ジャッジ時間 6,855 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

int main() {
    int n, k, t;
    std::cin >> n >> k >> t;

    std::vector<char> a(n);
    for (auto &e : a) std::cin >> e;
    std::vector<int> b(n);
    for (int &e : b) std::cin >> e;

    std::vector<int> c(n);
    for (int i = 0; i < n; ++i) c[i] = std::abs(((k + (a[i] == 'B' ? -b[i] : +b[i]) - t) % (2 * k) + 2 * k) % (2 * k) - k);
    std::sort(c.begin(), c.end());

    std::vector<int> p(n);
    std::iota(p.begin(), p.end(), 0);
    std::sort(p.begin(), p.end(), [&](int i, int j) { return b[i] < b[j]; });

    std::vector<int> ans(n);
    for (int i = 0; i < n; ++i) ans[p[i]] = c[i];
    for (int i = 0; i < n; ++i) std::cout << ans[i] << " \n"[i == n - 1];
}
0