#include "fish.h"
// author : sentheta aka vanwij
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<random>
#include<chrono>
#include<cmath>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
#define Int long long
#define V vector
#define pii pair<int,int>
#define ff first
#define ss second
#define rand() (uniform_int_distribution<int>(0,1<<30)(rng))
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pow2(x) (1LL<<(x))
#define msb(x) (63-__builtin_clzll(x))
#define bitcnt(x) (__builtin_popcountll(x))
#define nl '\n'
#define _ << ' ' <<
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define dbg(x) if(1) cout << "?" << #x << " : " << (x) << endl << flush;
const Int N = 2e5+5;
Int n, m;
V<Int> x, y, w;
Int zro[N], one[N];
Int max_weights(int _n,int _m,V<int> _x,V<int> _y,V<int> _w){
n = _n; m = _m;
x = V<Int>(all(_x)); y = V<Int>(all(_y)); w = V<Int>(all(_w));
rep(i,0,m){
if(x[i]==0) zro[y[i]] += w[i];
else one[y[i]] += w[i];
}
rep(i,1,N){
zro[i] += zro[i-1];
one[i] += one[i-1];
}
if(n <= 2){
return max(zro[n], one[n]);
}
Int ans = one[n];
rep(i,0,n){
ans = max(ans, zro[i] + one[n]-one[i]);
}
return ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
7124 KB |
Output is correct |
2 |
Correct |
28 ms |
8152 KB |
Output is correct |
3 |
Correct |
2 ms |
3412 KB |
Output is correct |
4 |
Correct |
2 ms |
3412 KB |
Output is correct |
5 |
Correct |
90 ms |
17388 KB |
Output is correct |
6 |
Incorrect |
89 ms |
17408 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 |
2 ms |
3412 KB |
Output is correct |
2 |
Correct |
46 ms |
11084 KB |
Output is correct |
3 |
Correct |
59 ms |
16204 KB |
Output is correct |
4 |
Correct |
24 ms |
8528 KB |
Output is correct |
5 |
Correct |
30 ms |
9784 KB |
Output is correct |
6 |
Correct |
2 ms |
3412 KB |
Output is correct |
7 |
Correct |
2 ms |
3412 KB |
Output is correct |
8 |
Correct |
2 ms |
3412 KB |
Output is correct |
9 |
Correct |
2 ms |
3412 KB |
Output is correct |
10 |
Correct |
2 ms |
3412 KB |
Output is correct |
11 |
Correct |
2 ms |
3348 KB |
Output is correct |
12 |
Correct |
24 ms |
8552 KB |
Output is correct |
13 |
Correct |
30 ms |
9804 KB |
Output is correct |
14 |
Correct |
25 ms |
8552 KB |
Output is correct |
15 |
Correct |
29 ms |
9220 KB |
Output is correct |
16 |
Correct |
25 ms |
8640 KB |
Output is correct |
17 |
Correct |
30 ms |
9216 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3412 KB |
Output is correct |
2 |
Correct |
2 ms |
3412 KB |
Output is correct |
3 |
Incorrect |
16 ms |
5948 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 |
2 ms |
3412 KB |
Output is correct |
2 |
Correct |
2 ms |
3412 KB |
Output is correct |
3 |
Correct |
2 ms |
3412 KB |
Output is correct |
4 |
Correct |
2 ms |
3412 KB |
Output is correct |
5 |
Correct |
2 ms |
3412 KB |
Output is correct |
6 |
Correct |
2 ms |
3412 KB |
Output is correct |
7 |
Correct |
2 ms |
3412 KB |
Output is correct |
8 |
Correct |
2 ms |
3376 KB |
Output is correct |
9 |
Incorrect |
2 ms |
3412 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3412 KB |
Output is correct |
2 |
Correct |
2 ms |
3412 KB |
Output is correct |
3 |
Correct |
2 ms |
3412 KB |
Output is correct |
4 |
Correct |
2 ms |
3412 KB |
Output is correct |
5 |
Correct |
2 ms |
3412 KB |
Output is correct |
6 |
Correct |
2 ms |
3412 KB |
Output is correct |
7 |
Correct |
2 ms |
3412 KB |
Output is correct |
8 |
Correct |
2 ms |
3376 KB |
Output is correct |
9 |
Incorrect |
2 ms |
3412 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3412 KB |
Output is correct |
2 |
Correct |
2 ms |
3412 KB |
Output is correct |
3 |
Correct |
2 ms |
3412 KB |
Output is correct |
4 |
Correct |
2 ms |
3412 KB |
Output is correct |
5 |
Correct |
2 ms |
3412 KB |
Output is correct |
6 |
Correct |
2 ms |
3412 KB |
Output is correct |
7 |
Correct |
2 ms |
3412 KB |
Output is correct |
8 |
Correct |
2 ms |
3376 KB |
Output is correct |
9 |
Incorrect |
2 ms |
3412 KB |
1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046' |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3412 KB |
Output is correct |
2 |
Correct |
2 ms |
3412 KB |
Output is correct |
3 |
Incorrect |
16 ms |
5948 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 |
23 ms |
7124 KB |
Output is correct |
2 |
Correct |
28 ms |
8152 KB |
Output is correct |
3 |
Correct |
2 ms |
3412 KB |
Output is correct |
4 |
Correct |
2 ms |
3412 KB |
Output is correct |
5 |
Correct |
90 ms |
17388 KB |
Output is correct |
6 |
Incorrect |
89 ms |
17408 KB |
1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000' |
7 |
Halted |
0 ms |
0 KB |
- |