#include "fish.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include<iterator>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_set>
using namespace std;
using ll = long long;
ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w){
map<ll,ll> zero, one;
ll one_sum = 0;
set<ll> y_cor;
for (int i = 0; i < m; i++){
if (x[i] == 0) zero[y[i]] = w[i];
else{
one[y[i]] = w[i];
one_sum += w[i];
}
y_cor.insert(y[i]);
}
ll curr_zero = 0, curr_one = 0, ans = one_sum;
for (auto y_pos : y_cor){
curr_zero += zero[y_pos];
curr_one += one[y_pos];
// cout << y_pos << ' ' << curr_zero << ' ' << curr_one << ' ' << curr_zero + one_sum - curr_one << '\n';
ans = max(ans, curr_zero + one_sum - curr_one);
}
if (n == 2) return max(curr_zero, one_sum);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
130 ms |
16008 KB |
Output is correct |
2 |
Correct |
176 ms |
19808 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
338 ms |
24488 KB |
Output is correct |
6 |
Incorrect |
320 ms |
23620 KB |
1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
284 ms |
19356 KB |
Output is correct |
3 |
Correct |
330 ms |
22220 KB |
Output is correct |
4 |
Correct |
126 ms |
16004 KB |
Output is correct |
5 |
Correct |
164 ms |
19868 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
141 ms |
16096 KB |
Output is correct |
13 |
Correct |
176 ms |
19868 KB |
Output is correct |
14 |
Correct |
139 ms |
16152 KB |
Output is correct |
15 |
Correct |
127 ms |
10844 KB |
Output is correct |
16 |
Correct |
121 ms |
16180 KB |
Output is correct |
17 |
Correct |
154 ms |
17836 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
20 ms |
1492 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310563953458' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310563953458' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310563953458' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
20 ms |
1492 KB |
1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
130 ms |
16008 KB |
Output is correct |
2 |
Correct |
176 ms |
19808 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
338 ms |
24488 KB |
Output is correct |
6 |
Incorrect |
320 ms |
23620 KB |
1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 |
Halted |
0 ms |
0 KB |
- |