Submission #635288

# Submission time Handle Problem Language Result Execution time Memory
635288 2022-08-25T21:31:51 Z gromperen Catfish Farm (IOI22_fish) C++17
6 / 100
95 ms 8804 KB
#include "fish.h"

#include <bits/stdc++.h>

#define ll long long

using namespace std;


long long max_weights(int N, int M, vector<int> X, vector<int> Y,
                      vector<int> W) {
	vector<ll> pre1(N+1);
	vector<ll> pre2(N+1);
	for (int i = 0; i < M; ++i) {
		if (X[i] == 0) pre1[Y[i]] += W[i];
		else pre2[Y[i]] += W[i];
	}
	for (int i = 1; i <= N; ++i) {
		pre1[i] += pre1[i-1];
		pre2[i] += pre2[i-1];
	}
	if (N <= 2) {
		return max(pre1[N], pre2[N]);
	}
	ll ans = 0;
	for (int i = 0; i <=N; ++i) {
		ll cur = pre1[i] + pre2[N] - pre2[i];
		//cerr << cur << endl;
		ans = max(ans, cur);
	}
	ans = max(ans, pre2[N]);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 22 ms 3560 KB Output is correct
2 Correct 26 ms 4168 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 2 ms 1876 KB Output is correct
5 Correct 95 ms 8804 KB Output is correct
6 Incorrect 85 ms 8800 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 0 ms 212 KB Output is correct
2 Correct 45 ms 5412 KB Output is correct
3 Correct 59 ms 6496 KB Output is correct
4 Correct 22 ms 3564 KB Output is correct
5 Correct 27 ms 4176 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 1748 KB Output is correct
11 Correct 2 ms 1748 KB Output is correct
12 Correct 23 ms 3532 KB Output is correct
13 Correct 27 ms 4172 KB Output is correct
14 Correct 23 ms 3572 KB Output is correct
15 Correct 26 ms 3916 KB Output is correct
16 Correct 23 ms 3576 KB Output is correct
17 Correct 25 ms 3924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Correct 2 ms 1876 KB Output is correct
3 Incorrect 14 ms 2900 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: '310323004046'
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: '310323004046'
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: '310323004046'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Correct 2 ms 1876 KB Output is correct
3 Incorrect 14 ms 2900 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 22 ms 3560 KB Output is correct
2 Correct 26 ms 4168 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 2 ms 1876 KB Output is correct
5 Correct 95 ms 8804 KB Output is correct
6 Incorrect 85 ms 8800 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -