답안 #635289

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
635289 2022-08-25T21:33:08 Z gromperen 메기 농장 (IOI22_fish) C++17
23 / 100
350 ms 88744 KB
#include "fish.h"

#include <bits/stdc++.h>

#define ll long long

using namespace std;

const int MAXN = 1e5+5;
ll pre[MAXN][10];
ll dp[MAXN][10][10];

long long max_weights(int N, int M, vector<int> X, vector<int> Y,
                      vector<int> W) {
	for (int i = 0; i < M; ++i) {
		pre[X[i]+1][Y[i]+1] += W[i];
	}
	for (int i = 1; i <= N; ++i) {
		for (int j = 1; j <= 9; ++j) {
			pre[i][j] += pre[i][j-1];
		}
	}

	ll ans = 0;
	for (int i = 2; i <= N; ++i) { for (int j = 0; j <= 9; ++j) {
	for (int k = 0; k <= 9; ++k) {
		if (i == 2) {
			if (j >= k) {
				dp[i][j][k] = pre[i-1][j] - pre[i-1][k];
			} else {
				dp[i][j][k] = pre[i][k] - pre[i][j];
			}
			ans = max(ans, dp[i][j][k]);
			continue;
		}
		for (int l = 0; l <= 9; ++l) {
			ll add = 0;
			if (l <= k && k <= j) {
				add = pre[i-1][j] - pre[i-1][k];  // 1 2 3
			} else if (l >= k && j >= l) {
				add = pre[i-1][j] - pre[i-1][l]; // 2 1 3
			} else if (l>=k && l>= j && j >= k) {
				add = 0; // 3 1 2
			} else if (k >= j) {
				add = pre[i][k] - pre[i][j]; // 1 3 2 and 2 3 1 and 3 2 1
			}
			dp[i][j][k] = max(dp[i][j][k], dp[i-1][k][l] + add);
		}
		ans = max(ans, dp[i][j][k]);
	}
	}
	}

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 277 ms 79684 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '25109166324195'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 350 ms 81692 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '49512534612877'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 285 ms 86332 KB Output is correct
2 Correct 275 ms 86280 KB Output is correct
3 Correct 294 ms 79068 KB Output is correct
4 Correct 285 ms 87348 KB Output is correct
5 Correct 325 ms 88680 KB Output is correct
6 Correct 308 ms 88652 KB Output is correct
7 Correct 305 ms 88708 KB Output is correct
8 Correct 313 ms 88744 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 2 ms 596 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 2 ms 596 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Incorrect 2 ms 468 KB 1st lines differ - on the 1st token, expected: '299', found: '245'
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 596 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 2 ms 596 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Incorrect 2 ms 468 KB 1st lines differ - on the 1st token, expected: '299', found: '245'
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 285 ms 86332 KB Output is correct
2 Correct 275 ms 86280 KB Output is correct
3 Correct 294 ms 79068 KB Output is correct
4 Correct 285 ms 87348 KB Output is correct
5 Correct 325 ms 88680 KB Output is correct
6 Correct 308 ms 88652 KB Output is correct
7 Correct 305 ms 88708 KB Output is correct
8 Correct 313 ms 88744 KB Output is correct
9 Runtime error 27 ms 5336 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 277 ms 79684 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '25109166324195'
2 Halted 0 ms 0 KB -