#include "fish.h"
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<int, int> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<long long> vl;
typedef vector<vl> vvl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define nl endl
#define S second
#define lb lower_bound
#define ub upper_bound
#define aint(x) x.begin(), x.end()
#define raint(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;
long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
vvi pos(3,vi(N,0));
FOR(i,0,M)pos[X[i]][Y[i]] += W[i];
vl arr(3,0);
FOR(i,0,M)arr[X[i]] += W[i];
if(N == 2){
return max(arr[0],arr[1]);
}
ll ans = 0;
ans = max(ans,arr[1]+arr[2]);
FOR(i,0,N){
arr[2] += pos[0][i];
arr[1] -= pos[1][i];
ans = max(ans,arr[1]+arr[2]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
3672 KB |
Output is correct |
2 |
Correct |
17 ms |
4172 KB |
Output is correct |
3 |
Correct |
1 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Runtime error |
56 ms |
17128 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 |
28 ms |
5464 KB |
Output is correct |
3 |
Correct |
35 ms |
6620 KB |
Output is correct |
4 |
Correct |
16 ms |
3672 KB |
Output is correct |
5 |
Correct |
20 ms |
4188 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
1880 KB |
Output is correct |
11 |
Correct |
1 ms |
1884 KB |
Output is correct |
12 |
Correct |
14 ms |
3676 KB |
Output is correct |
13 |
Correct |
17 ms |
4256 KB |
Output is correct |
14 |
Correct |
18 ms |
5132 KB |
Output is correct |
15 |
Correct |
16 ms |
5724 KB |
Output is correct |
16 |
Correct |
15 ms |
4956 KB |
Output is correct |
17 |
Correct |
17 ms |
5620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Runtime error |
3 ms |
2772 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Runtime error |
3 ms |
2772 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
3672 KB |
Output is correct |
2 |
Correct |
17 ms |
4172 KB |
Output is correct |
3 |
Correct |
1 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Runtime error |
56 ms |
17128 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |