Submission #627251

# Submission time Handle Problem Language Result Execution time Memory
627251 2022-08-12T11:42:10 Z coloboxx Catfish Farm (IOI22_fish) C++17
9 / 100
32 ms 6464 KB
#include "fish.h"
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int MAXN = 300064;

ll a[MAXN], dp[MAXN][2];

ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
	for (int i = 0; i < M; ++i)
		a[X[i] + 1] = W[i];

	for (int i = 2; i <= N; ++i) {
		dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + a[i]);
		dp[i][1] = dp[i - 1][1];

		if (i > 2) dp[i][1] = max({ dp[i][1], dp[i - 2][0] + a[i - 1], dp[i - 2][1] + a[i - 1] });
		else dp[i][1] = max(dp[i][1], a[i - 1]);
	}

	ll ans = 0;
	for (int i = 1; i <= N; ++i)
		ans = max({ ans, dp[i][0], dp[i][1] });
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 4208 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
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: '2', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1876 KB Output is correct
2 Correct 2 ms 1876 KB Output is correct
3 Correct 16 ms 3892 KB Output is correct
4 Correct 12 ms 3284 KB Output is correct
5 Correct 31 ms 5068 KB Output is correct
6 Correct 24 ms 5964 KB Output is correct
7 Correct 32 ms 6464 KB Output is correct
8 Correct 27 ms 6448 KB Output is correct
# 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 1876 KB Output is correct
2 Correct 2 ms 1876 KB Output is correct
3 Correct 16 ms 3892 KB Output is correct
4 Correct 12 ms 3284 KB Output is correct
5 Correct 31 ms 5068 KB Output is correct
6 Correct 24 ms 5964 KB Output is correct
7 Correct 32 ms 6464 KB Output is correct
8 Correct 27 ms 6448 KB Output is correct
9 Incorrect 30 ms 5852 KB 1st lines differ - on the 1st token, expected: '99999', found: '66666'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 4208 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -