結果

問題 No.2482 Sandglasses
ユーザー SnowBeenDidingSnowBeenDiding
提出日時 2023-09-29 19:08:40
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 421 ms / 2,000 ms
コード長 982 bytes
コンパイル時間 5,992 ms
コンパイル使用メモリ 318,144 KB
実行使用メモリ 20,736 KB
最終ジャッジ日時 2024-04-28 09:05:23
合計ジャッジ時間 19,251 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 359 ms
20,608 KB
testcase_04 AC 373 ms
20,736 KB
testcase_05 AC 371 ms
20,736 KB
testcase_06 AC 386 ms
20,736 KB
testcase_07 AC 385 ms
20,608 KB
testcase_08 AC 379 ms
20,608 KB
testcase_09 AC 394 ms
20,608 KB
testcase_10 AC 376 ms
20,608 KB
testcase_11 AC 387 ms
20,736 KB
testcase_12 AC 406 ms
20,608 KB
testcase_13 AC 391 ms
20,736 KB
testcase_14 AC 392 ms
20,608 KB
testcase_15 AC 407 ms
20,608 KB
testcase_16 AC 414 ms
20,608 KB
testcase_17 AC 411 ms
20,736 KB
testcase_18 AC 421 ms
20,608 KB
testcase_19 AC 392 ms
20,736 KB
testcase_20 AC 392 ms
20,608 KB
testcase_21 AC 375 ms
20,736 KB
testcase_22 AC 382 ms
20,736 KB
testcase_23 AC 389 ms
20,608 KB
testcase_24 AC 382 ms
20,736 KB
testcase_25 AC 383 ms
20,608 KB
testcase_26 AC 381 ms
20,736 KB
testcase_27 AC 377 ms
20,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace std;
using namespace atcoder;

typedef long long ll;

ll f(ll n, ll x, ll t, char c) {
    t %= n * 2;
    if (t >= n) {
        c ^= 'A';
        c ^= 'B';
        x = n - x;
        t -= n;
    }
    if (c == 'B') {
        if (x + t <= n) {
            return x + t;
        } else {
            ll mi = x + t - n;
            return n - mi;
        }
    } else {
        return abs(x - t);
    }
}

int main() {
    ll n, k, t;
    cin >> n >> k >> t;
    vector<char> a(n);
    vector<ll> b(n);
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, n) cin >> b[i];
    vector<ll> bsort = b;
    sort(bsort.begin(), bsort.end());
    vector<ll> anssort(n);
    rep(i, 0, n) { anssort[i] = f(k, b[i], t, a[i]); }
    sort(anssort.begin(), anssort.end());
    map<ll, ll> mp;
    rep(i, 0, n) mp[bsort[i]] = anssort[i];
    rep(i, 0, n) cout << mp[b[i]] << ' ';
}
0