답안 #627243

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
627243 2022-08-12T11:37:40 Z coloboxx 메기 농장 (IOI22_fish) C++17
0 / 100
66 ms 8208 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 = 1; 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 > 1)
			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], dp[i - 1][0] + a[i - 1]);
	}

	ll ans = 0;
	for (int i = 1; i <= N; ++i)
		ans = max({ ans, dp[i][0], dp[i][1] });
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 4940 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 66 ms 8208 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '1061656034'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1876 KB Output is correct
2 Correct 3 ms 1844 KB Output is correct
3 Incorrect 23 ms 4612 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '21261871744627'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1876 KB Output is correct
2 Correct 3 ms 1844 KB Output is correct
3 Incorrect 23 ms 4612 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '21261871744627'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 4940 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -