#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int INF=1e9;
const ll LINF=1e18;
#define fi first
#define se second
#define pii pair<int,int>
#define mid ((l+r)/2)
#define sz(a) (int((a).size()))
#define all(a) a.begin(),a.end()
#define endl "\n"
#define PRINT(x) cerr<<#x<<'='<<x<<endl;
#define pb push_back
#define PRINTvec(niz) { cerr<<#niz<<"="; for(auto _i:niz) cerr<<_i<<" "; cerr<<endl; }
long long max_weights(int N,int M,vector<int> X,vector<int> Y,vector<int> W){
ll res=0;
ll sum0=0,sum1=0;
for(int i=0;i<M;i++){
if(X[i]==0){
sum0+=W[i];
}
else{
sum1+=W[i];
}
}
res=max(sum1,sum0);
if(N>2){
sum0=0;
vector<vector<int>> we(2,vector<int>(N,0));
for(int i=0;i<M;i++){
we[X[i]][Y[i]]=W[i];
}
for(int k=0;k<N;k++){
sum0+=we[0][k];
sum1-=we[1][k];
res=max(res,sum0+sum1);
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
3156 KB |
Output is correct |
2 |
Correct |
30 ms |
3796 KB |
Output is correct |
3 |
Correct |
1 ms |
1364 KB |
Output is correct |
4 |
Correct |
1 ms |
1364 KB |
Output is correct |
5 |
Runtime error |
93 ms |
16236 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
45 ms |
5160 KB |
Output is correct |
3 |
Correct |
58 ms |
9552 KB |
Output is correct |
4 |
Correct |
24 ms |
4556 KB |
Output is correct |
5 |
Correct |
32 ms |
5564 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
300 KB |
Output is correct |
10 |
Correct |
1 ms |
1492 KB |
Output is correct |
11 |
Correct |
1 ms |
1364 KB |
Output is correct |
12 |
Correct |
23 ms |
4564 KB |
Output is correct |
13 |
Correct |
27 ms |
5564 KB |
Output is correct |
14 |
Correct |
24 ms |
4584 KB |
Output is correct |
15 |
Correct |
28 ms |
5172 KB |
Output is correct |
16 |
Correct |
24 ms |
4576 KB |
Output is correct |
17 |
Correct |
28 ms |
5056 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1364 KB |
Output is correct |
2 |
Runtime error |
2 ms |
1996 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1364 KB |
Output is correct |
2 |
Runtime error |
2 ms |
1996 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
3156 KB |
Output is correct |
2 |
Correct |
30 ms |
3796 KB |
Output is correct |
3 |
Correct |
1 ms |
1364 KB |
Output is correct |
4 |
Correct |
1 ms |
1364 KB |
Output is correct |
5 |
Runtime error |
93 ms |
16236 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |