結果
問題 | No.2482 Sandglasses |
ユーザー |
![]() |
提出日時 | 2023-09-23 00:21:52 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 200 ms / 2,000 ms |
コード長 | 2,127 bytes |
コンパイル時間 | 1,359 ms |
コンパイル使用メモリ | 122,652 KB |
実行使用メモリ | 20,480 KB |
最終ジャッジ日時 | 2024-04-28 09:04:01 |
合計ジャッジ時間 | 8,764 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 189 ms
20,480 KB |
testcase_04 | AC | 200 ms
20,480 KB |
testcase_05 | AC | 194 ms
20,480 KB |
testcase_06 | AC | 185 ms
20,480 KB |
testcase_07 | AC | 187 ms
20,352 KB |
testcase_08 | AC | 191 ms
20,480 KB |
testcase_09 | AC | 184 ms
20,352 KB |
testcase_10 | AC | 189 ms
20,352 KB |
testcase_11 | AC | 194 ms
20,480 KB |
testcase_12 | AC | 184 ms
20,480 KB |
testcase_13 | AC | 189 ms
20,480 KB |
testcase_14 | AC | 187 ms
20,480 KB |
testcase_15 | AC | 186 ms
20,480 KB |
testcase_16 | AC | 186 ms
20,352 KB |
testcase_17 | AC | 187 ms
20,480 KB |
testcase_18 | AC | 188 ms
20,480 KB |
testcase_19 | AC | 185 ms
20,480 KB |
testcase_20 | AC | 191 ms
20,352 KB |
testcase_21 | AC | 195 ms
20,480 KB |
testcase_22 | AC | 185 ms
20,352 KB |
testcase_23 | AC | 178 ms
20,352 KB |
testcase_24 | AC | 196 ms
20,352 KB |
testcase_25 | AC | 184 ms
20,480 KB |
testcase_26 | AC | 184 ms
20,352 KB |
testcase_27 | AC | 188 ms
20,480 KB |
ソースコード
// #pragma GCC target("avx2") // #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") #include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> using namespace std; using lg = long long; using pii = pair<int, int>; using pll = pair<lg, lg>; #define TEST cerr << "TEST" << endl #define AMARI 998244353 //#define AMARI 1000000007 #define TEMOTO ((sizeof(long double) == 16) ? false : true) #define TIME_LIMIT 1980 * (TEMOTO ? 1 : 1000) #define el '\n' #define El '\n' #define MULTI_TEST_CASE false void solve(void) { int n; cin >> n; lg k,t; cin >> k >> t; //i番目の砂時計について、aが上かどうか vector<bool> aue(n); //i番目の砂時計について、aにどのくらい入っているか vector<lg> a(n); map<lg,int> mp; for(int i = 0; i < n; i++){ char c; cin >> c; aue[i] = (c == 'A'); } for(int i = 0; i < n; i++){ cin >> a[i]; mp[a[i]] = i; } //aにどれくらい入っているか vector<lg> a2(n); for(int i = 0; i < n; i++){ if(aue[i]){ //最初aが減る a2[i] = a[i] - t; if(a2[i] < 0)a2[i] *= -1; if(a2[i] > k)a2[i] = k - (a2[i] - k); } if(!aue[i]){ //最初aが増える a2[i] = a[i] + t; if(a2[i] > k)a2[i] = k - (a2[i] - k); if(a2[i] < 0)a2[i] *= -1; } } sort(a.begin(),a.end()); sort(a2.begin(),a2.end()); vector<lg> ans(n); for(int i = 0; i < n; i++){ ans[mp[a[i]]] = a2[i]; } for(int i = 0; i < n; i++){ cout << ans[i] << ' '; } cout << el; return; } void calc(void) { return; } int main(void) { cin.tie(nullptr); ios::sync_with_stdio(false); calc(); int t = 1; if(MULTI_TEST_CASE) cin >> t; while(t--) { solve(); } return 0; }