結果

問題 No.2482 Sandglasses
ユーザー hiromi_ayasehiromi_ayase
提出日時 2023-09-22 23:01:44
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 1,162 bytes
コンパイル時間 6,047 ms
コンパイル使用メモリ 333,224 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-04-28 09:03:16
合計ジャッジ時間 12,238 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 108 ms
12,800 KB
testcase_04 AC 136 ms
12,800 KB
testcase_05 AC 108 ms
12,800 KB
testcase_06 AC 109 ms
12,672 KB
testcase_07 AC 108 ms
12,544 KB
testcase_08 AC 109 ms
12,544 KB
testcase_09 AC 109 ms
12,672 KB
testcase_10 AC 108 ms
12,800 KB
testcase_11 AC 109 ms
12,672 KB
testcase_12 AC 110 ms
12,672 KB
testcase_13 AC 108 ms
12,672 KB
testcase_14 AC 110 ms
12,672 KB
testcase_15 AC 110 ms
12,800 KB
testcase_16 AC 111 ms
12,672 KB
testcase_17 AC 109 ms
12,672 KB
testcase_18 AC 110 ms
12,672 KB
testcase_19 AC 110 ms
12,672 KB
testcase_20 AC 112 ms
12,672 KB
testcase_21 AC 110 ms
12,672 KB
testcase_22 AC 109 ms
12,672 KB
testcase_23 AC 106 ms
12,672 KB
testcase_24 AC 107 ms
12,672 KB
testcase_25 AC 106 ms
12,672 KB
testcase_26 AC 109 ms
12,672 KB
testcase_27 AC 106 ms
12,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0