답안 #627222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
627222 2022-08-12T11:34:10 Z coloboxx 메기 농장 (IOI22_fish) C++17
0 / 100
49 ms 5536 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) {
	swap(X, Y);

	for (int i = 0; i < M; ++i)
		a[Y[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]});
	}

	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 24 ms 3532 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 49 ms 5536 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 1 ms 1876 KB Output is correct
3 Incorrect 17 ms 3616 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 1 ms 1876 KB Output is correct
3 Incorrect 17 ms 3616 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '21261871744627'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 3532 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -