#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define re resize
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define all1(x) (x).begin()+1, (x).end()
#define loop(i, n) for(int i = 0; i < n; i++)
#define loop1(i, n) for(int i = 1; i <= n; i++)
#define print(x) cout << #x << ": " << x << endl << flush
template<class T> bool ckmin(T&a, T b) { bool B = a > b; a = min(a, b); return B; }
template<class T> bool ckmax(T&a, T b) { bool B = a < b; a = max(a, b); return B; }
typedef long long ll;
typedef vector<int> vi;
ll max_weights(int n, int m, vi x, vi y, vi w) {
ll fish[2][n];
loop(i, n) {
fish[0][i] = 0;
fish[1][i] = 0;
}
loop(i, m)
fish[x[i]][y[i]] = w[i];
ll res = 0;
loop1(i, n-1) fish[0][i] += fish[0][i-1];
loop1(i, n-1) fish[1][i] += fish[1][i-1];
res = max(fish[0][n-1], fish[1][n-1]);
if(n >= 3)
loop(i, n)
ckmax(res, fish[1][n-1] + fish[0][i] - fish[1][i]);
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
3556 KB |
Output is correct |
2 |
Correct |
28 ms |
4180 KB |
Output is correct |
3 |
Correct |
1 ms |
1748 KB |
Output is correct |
4 |
Correct |
2 ms |
1748 KB |
Output is correct |
5 |
Runtime error |
92 ms |
17764 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
51 ms |
5524 KB |
Output is correct |
3 |
Correct |
58 ms |
9932 KB |
Output is correct |
4 |
Correct |
24 ms |
4944 KB |
Output is correct |
5 |
Correct |
29 ms |
5932 KB |
Output is correct |
6 |
Correct |
1 ms |
300 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
1832 KB |
Output is correct |
11 |
Correct |
2 ms |
1748 KB |
Output is correct |
12 |
Correct |
24 ms |
4940 KB |
Output is correct |
13 |
Correct |
29 ms |
5940 KB |
Output is correct |
14 |
Correct |
23 ms |
4956 KB |
Output is correct |
15 |
Correct |
28 ms |
5564 KB |
Output is correct |
16 |
Correct |
26 ms |
4956 KB |
Output is correct |
17 |
Correct |
29 ms |
5436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1748 KB |
Output is correct |
2 |
Runtime error |
2 ms |
3560 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
1st lines differ - on the 1st token, expected: '3', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1748 KB |
Output is correct |
2 |
Runtime error |
2 ms |
3560 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
3556 KB |
Output is correct |
2 |
Correct |
28 ms |
4180 KB |
Output is correct |
3 |
Correct |
1 ms |
1748 KB |
Output is correct |
4 |
Correct |
2 ms |
1748 KB |
Output is correct |
5 |
Runtime error |
92 ms |
17764 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |