結果

問題 No.2482 Sandglasses
ユーザー 沙耶花沙耶花
提出日時 2023-09-22 21:42:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 910 bytes
コンパイル時間 4,746 ms
コンパイル使用メモリ 267,980 KB
実行使用メモリ 9,608 KB
最終ジャッジ日時 2024-04-28 09:00:44
合計ジャッジ時間 12,254 ms
ジャッジサーバーID
(参考情報)
judge4 / 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 164 ms
9,476 KB
testcase_04 AC 168 ms
9,480 KB
testcase_05 AC 168 ms
9,604 KB
testcase_06 AC 168 ms
9,524 KB
testcase_07 AC 166 ms
9,472 KB
testcase_08 AC 168 ms
9,604 KB
testcase_09 AC 167 ms
9,476 KB
testcase_10 AC 165 ms
9,476 KB
testcase_11 AC 160 ms
9,480 KB
testcase_12 AC 179 ms
9,476 KB
testcase_13 AC 169 ms
9,604 KB
testcase_14 AC 166 ms
9,608 KB
testcase_15 AC 161 ms
9,480 KB
testcase_16 AC 171 ms
9,600 KB
testcase_17 AC 175 ms
9,588 KB
testcase_18 AC 175 ms
9,560 KB
testcase_19 AC 170 ms
9,476 KB
testcase_20 AC 165 ms
9,476 KB
testcase_21 AC 168 ms
9,600 KB
testcase_22 AC 171 ms
9,608 KB
testcase_23 AC 159 ms
9,604 KB
testcase_24 AC 162 ms
9,604 KB
testcase_25 AC 166 ms
9,600 KB
testcase_26 AC 160 ms
9,472 KB
testcase_27 AC 158 ms
9,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001


int main(){
	
	long long N,K,T;
	cin>>N>>K>>T;
	
	vector<pair<char,long long>> x(N);
	rep(i,N)cin>>x[i].first;
	vector<long long> ps;
	rep(i,N){
		cin>>x[i].second;
		long long cur = x[i].second;
		if(x[i].first=='A'){
			cur = K+K-cur;
		}
		cur += T;
		cur %= (K*2);
		if(cur<=K)ps.push_back(cur);
		else{
			ps.push_back(K-(cur-K));
		}
	}
	sort(ps.begin(),ps.end());
	vector<int> pos(N);
	rep(i,N)pos[i] = i;
	sort(pos.begin(),pos.end(),[&](int a,int b){
		return x[a].second<x[b].second;
	});
	{
		vector<int> pp(N);
		rep(i,N){
			pp[pos[i]] = i;
		}
		swap(pp,pos);
	}
	rep(i,N){
		if(i!=0)cout<<' ';
		cout<<ps[pos[i]];
	}
	cout<<endl;
	
	return 0;
}
0