結果
| 問題 |
No.2804 Fixer And Ratism
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-12 21:23:04 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,559 bytes |
| コンパイル時間 | 3,554 ms |
| コンパイル使用メモリ | 276,380 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-12 21:23:34 |
| 合計ジャッジ時間 | 18,944 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 20 TLE * 2 |
ソースコード
// #include <bits/allocator.h> // Temp fix for gcc13 global pragma
// #pragma GCC target("avx2,bmi2,popcnt,lzcnt")
// #pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
#if __cplusplus >= 202002L
using namespace numbers;
#endif
#ifdef LOCAL
#include "Debug.h"
#else
#define debug_endl() 42
#define debug(...) 42
#define debug2(...) 42
#define debugbin(...) 42
#endif
int main(){
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(ios::badbit | ios::failbit);
int computer, qn;
cin >> computer >> qn;
set<string> contributed;
map<int, string, greater<>> name_by_rating;
vector<string> res;
for(auto qi = 0; qi < qn; ++ qi){
int type;
cin >> type;
if(type == 1){
string name;
int r;
cin >> name >> r;
name_by_rating[r] = name;
}
else if(type == 2){
int x;
cin >> x;
computer -= x;
}
else{
string s;
int x;
cin >> s >> x;
contributed.insert(s);
computer += x;
}
static vector<pair<int, string>> left;
left.clear();
int rem = computer;
for(auto [r, s]: name_by_rating){
if(contributed.contains(s)){
if(!rem){
left.push_back({r, s});
}
else{
-- rem;
}
}
}
for(auto [r, s]: name_by_rating){
if(!contributed.contains(s)){
if(!rem){
left.push_back({r, s});
}
else{
-- rem;
}
}
}
for(auto [r, s]: left | ranges::views::reverse){
name_by_rating.erase(r);
res.push_back(s);
}
}
ranges::copy(res, ostream_iterator<string>(cout, "\n"));
return 0;
}
/*
*/