結果
| 問題 |
No.2482 Sandglasses
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2023-09-25 11:04:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 99 ms / 2,000 ms |
| コード長 | 998 bytes |
| コンパイル時間 | 625 ms |
| コンパイル使用メモリ | 48,640 KB |
| 実行使用メモリ | 7,936 KB |
| 最終ジャッジ日時 | 2024-11-16 22:57:05 |
| 合計ジャッジ時間 | 6,140 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 2482.cc: No.2482 Sandglasses - yukicoder
*/
#include<cstdio>
#include<algorithm>
#include<utility>
using namespace std;
/* constant */
const int MAX_N = 200000;
/* typedef */
typedef long long ll;
typedef pair<int,int> pii;
/* global variables */
int as[MAX_N], bs[MAX_N], cs[MAX_N], ds[MAX_N];
pii bis[MAX_N];
/* subroutines */
/* main */
int main() {
int n, k, t;
scanf("%d%d%d", &n, &k, &t);
for (int i = 0; i < n; i++) {
char s[4];
scanf("%s", s);
as[i] = s[0];
}
for (int i = 0; i < n; i++) scanf("%d", bs + i);
int k2 = k * 2;
t %= k2;
for (int i = 0; i < n; i++) {
bis[i] = pii(bs[i], i);
int ti = (as[i] == 'B') ? ((ll)bs[i] + t) % k2 : ((ll)k2 - bs[i] + t) % k2;
cs[i] = (ti < k) ? ti : k2 - ti;
}
sort(bis, bis + n);
sort(cs, cs + n);
for (int i = 0; i < n; i++) ds[bis[i].second] = cs[i];
for (int i = 0; i < n; i++)
printf("%d%c", ds[i], (i + 1 < n) ? ' ' : '\n');
return 0;
}
tnakao0123