QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#135617 | #3872. Gym Badges | Wawi# | 0 | 144ms | 11208kb | C++20 | 869b | 2023-08-05 19:40:43 | 2024-07-04 01:17:43 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
int n; cin >> n;
vector<pair<ll,ll>> arr(n);
for(int i=0; i < n;i++) cin >> arr[i].second;
for(int i=0; i < n;i++) cin >> arr[i].first;
sort(arr.begin(),arr.end());
ll curr=0;
multiset<ll> st;
for(int i=0; i < n;i++){
if(curr<=arr[i].first){
curr += arr[i].second;
st.insert(arr[i].second);
}
else{
curr += arr[i].second;
st.insert(arr[i].second);
curr -= *st.rbegin();
st.erase(st.find(*st.rbegin()));
}
cout << curr << ' ';
}
cout << st.size() << endl;
}
int main() {
ios::sync_with_stdio(false);cout.tie(0);cin.tie(0);
int t=1;
// cin >> t;
while(t--){
solve();
}
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3772kb
input:
8 539270098 632706230 269629236 114860227 516388668 106926736 442326081 489479590 349109371 304195858 1 1 1 1 1 272176035
output:
106926736 106926736 106926736 106926736 106926736 596406326 596406326 596406326 2
result:
wrong answer 1st lines differ - expected: '2', found: '106926736 106926736 106926736 ...596406326 596406326 596406326 2'
Subtask #2:
score: 0
Wrong Answer
Test #21:
score: 0
Wrong Answer
time: 144ms
memory: 11208kb
input:
499024 24194059 58419582 93795671 46748573 538530 94101772 6557176 45861806 13697565 74131600 86230763 495874 93328371 85034659 58261516 3311420 83620814 92145308 62793177 67970802 63891191 62175600 59686038 44916927 32817940 23191454 40796822 55385422 97662235 82408332 33350127 65553532 70025555 47...
output:
3 46 232 435 797 1519 2464 3431 4525 5855 7276 9107 11183 13317 15583 18326 21102 24477 27987 32420 36859 41372 46088 50906 55862 61145 66505 71918 77744 83885 90258 96635 103574 110904 118339 125783 133329 140918 148685 156494 164327 172220 180120 188375 196714 205206 213774 222443 231284 240245 24...
result:
wrong answer 1st lines differ - expected: '1792', found: '3 46 232 435 797 1519 2464 343...826132 317826132 317826132 1792'
Subtask #3:
score: 0
Wrong Answer
Test #41:
score: 0
Wrong Answer
time: 2ms
memory: 3928kb
input:
4920 343676952 471362068 183764630 14272498 286605010 453007536 667797750 174763306 161753738 692259390 402384334 207809675 24816038 135559720 2349171 268297289 158915976 311483232 237276350 130673100 523233652 177852180 84082840 350906472 27172979 107661274 8628817 205814954 636498502 115751626 451...
output:
17030168 17030168 17030168 17030168 17030168 144403 3013268 286883 286883 321583 953424059 246096117 5331074 5331074 5331074 5331074 5331074 787425 2037639 2037639 2037639 2037639 2037639 2037639 2037639 2037639 2037639 2037639 2037639 2037639 2037639 2037639 1289360 1289360 1289360 1289360 13915776...
result:
wrong answer 1st lines differ - expected: '200', found: '17030168 17030168 17030168 170...1246173 981246173 973042957 199'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%