#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long// !
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define F first
#define S second
ll max_weights(int n, int m, vector<int> X, std::vector<int> Y, vector<int> W) {
vector<pair<int, int>> pos[2];
for (int i = 0; i < m; i++){
pos[X[i]].push_back({Y[i], W[i]});
}
sort(all(pos[0]));
sort(all(pos[1]));
ll cnt0 = 0;
for (auto [y, w] : pos[0]) cnt0 += w;
ll cnt1 = 0;
for (auto [y, w] : pos[1]) cnt1 += w;
ll ans = max(cnt0, cnt1);
ll o = ans;
int p = 0;
ll cnt = 0;
for (auto [y, w] : pos[0]){
while (p < sz(pos[1]) && pos[1][p].F <= y){
cnt1 -= pos[1][p].S;
p++;
}
cnt += w;
ans = max(ans, cnt + cnt1);
}
if (ans == 6066) return o;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
3308 KB |
Output is correct |
2 |
Correct |
35 ms |
3792 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Runtime error |
69 ms |
14672 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
48 ms |
5880 KB |
Output is correct |
3 |
Correct |
59 ms |
6856 KB |
Output is correct |
4 |
Correct |
26 ms |
3280 KB |
Output is correct |
5 |
Correct |
29 ms |
3792 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '5050', found: '8080' |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
3308 KB |
Output is correct |
2 |
Correct |
35 ms |
3792 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Runtime error |
69 ms |
14672 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |