結果

問題 No.2482 Sandglasses
ユーザー AerenAeren
提出日時 2023-09-22 21:58:44
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 1,392 bytes
コンパイル時間 4,182 ms
コンパイル使用メモリ 263,324 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-04-28 09:01:22
合計ジャッジ時間 8,556 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 87 ms
6,400 KB
testcase_04 AC 87 ms
6,400 KB
testcase_05 AC 86 ms
6,400 KB
testcase_06 AC 81 ms
6,400 KB
testcase_07 AC 77 ms
6,528 KB
testcase_08 AC 87 ms
6,400 KB
testcase_09 AC 77 ms
6,400 KB
testcase_10 AC 79 ms
6,400 KB
testcase_11 AC 79 ms
6,400 KB
testcase_12 AC 84 ms
6,528 KB
testcase_13 AC 84 ms
6,528 KB
testcase_14 AC 78 ms
6,528 KB
testcase_15 AC 78 ms
6,400 KB
testcase_16 AC 77 ms
6,400 KB
testcase_17 AC 80 ms
6,400 KB
testcase_18 AC 81 ms
6,400 KB
testcase_19 AC 80 ms
6,528 KB
testcase_20 AC 79 ms
6,400 KB
testcase_21 AC 79 ms
6,400 KB
testcase_22 AC 80 ms
6,528 KB
testcase_23 AC 80 ms
6,528 KB
testcase_24 AC 77 ms
6,528 KB
testcase_25 AC 80 ms
6,400 KB
testcase_26 AC 82 ms
6,400 KB
testcase_27 AC 82 ms
6,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////
0