結果
問題 | No.2623 Room Allocation |
ユーザー |
|
提出日時 | 2024-02-09 21:38:36 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 659 bytes |
コンパイル時間 | 2,927 ms |
コンパイル使用メモリ | 258,116 KB |
実行使用メモリ | 9,504 KB |
最終ジャッジ日時 | 2024-09-28 14:54:12 |
合計ジャッジ時間 | 4,814 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
// #pragma GCC optimize("O3,unroll-loops")#include <bits/stdc++.h>// #include <x86intrin.h>using namespace std;#if __cplusplus >= 202002Lusing namespace numbers;#endifint main(){cin.tie(0)->sync_with_stdio(0);cin.exceptions(ios::badbit | ios::failbit);int n, x, y;cin >> n >> x >> y;vector<array<long long, 2>> cnt(x + y);for(auto i = 0; i < n; ++ i){int size;char c;cin >> size >> c;cnt[i % (x + y)][c - 'A'] += size;}ranges::sort(cnt, [&](auto x, auto y){ return x[0] - x[1] > y[0] - y[1]; });long long res = 0;for(auto i = 0; i < x + y; ++ i){res += cnt[i][i >= x];}cout << res << "\n";return 0;}/**/