답안 #1056598

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056598 2024-08-13T10:13:08 Z dozer 메기 농장 (IOI22_fish) C++17
0 / 100
11 ms 6488 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define sp " "
#define endl "\n"
#define pii pair<int, int>
#define st first
#define nd second
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define ll long long
#define LL node * 2
#define RR node * 2 + 1
#define MAXN 300005

const int modulo = 1e9 + 7;
const ll INF = 2e18 + 7;

ll dp[MAXN], arr[MAXN];

long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
	int n = N, m = M;
	for (int i = 0; i <= n; i++) arr[i] = 0;

    for (int i = 0; i < m; i++) arr[X[i] + 1] = W[i];
    
    dp[0] = 0;
    dp[1] = arr[1];
 	for (int i = 2; i <= n; i++){
 		dp[i] = max(dp[i - 1], arr[i] + dp[i - 2]);
 	}

 	return dp[n];

}


/*
int main() {
	fileio();
	int N, M;
	assert(2 == scanf("%d %d", &N, &M));

	std::vector<int> X(M), Y(M), W(M);
	for (int i = 0; i < M; ++i) {
		assert(3 == scanf("%d %d %d", &X[i], &Y[i], &W[i]));
	}

	long long result = max_weights(N, M, X, Y, W);
	printf("%lld\n", result);
	return 0;
}
*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 6488 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2396 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4700 KB Output is correct
2 Correct 1 ms 4700 KB Output is correct
3 Incorrect 8 ms 5980 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4700 KB Output is correct
2 Correct 1 ms 4700 KB Output is correct
3 Incorrect 8 ms 5980 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 6488 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -