Submission #1088715

# Submission time Handle Problem Language Result Execution time Memory
1088715 2024-09-14T21:32:04 Z gustavo_d Horses (IOI15_horses) C++17
17 / 100
256 ms 524288 KB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;

const int MX_COW=1000;

int init(int N, int X[], int Y[]) {
	int n = N+1;
	vector<int> x(n), y(n);
	for (int i=1; i<n; i++) x[i] = X[i-1];
	for (int i=1; i<n; i++) y[i] = Y[i-1];

	int dp[n][MX_COW+1];
	for (int i=1; i<=MX_COW; i++) {
		dp[0][i] = -1e9;
	}
	dp[0][1] = 0;
	for (int i=1; i<n; i++) {
		for (int cow=0; cow<=MX_COW; cow++) {
			dp[i][cow] = -1e9;
			for (int v=0; v<=MX_COW; v++) {
				if ((cow+v)/x[i] > MX_COW) continue;
				if ((cow+v) % x[i] != 0) continue;
				dp[i][cow] = max(
					dp[i][cow],
					dp[i-1][(cow + v) / x[i]] + v * y[i]
				);
			}
		}
	}
	return dp[n-1][0];
}

int updateX(int pos, int val) {	
	return 0;
}

int updateY(int pos, int val) {
	return 0;
}

Compilation message

horses.cpp: In function 'int updateX(int, int)':
horses.cpp:34:17: warning: unused parameter 'pos' [-Wunused-parameter]
   34 | int updateX(int pos, int val) {
      |             ~~~~^~~
horses.cpp:34:26: warning: unused parameter 'val' [-Wunused-parameter]
   34 | int updateX(int pos, int val) {
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:38:17: warning: unused parameter 'pos' [-Wunused-parameter]
   38 | int updateY(int pos, int val) {
      |             ~~~~^~~
horses.cpp:38:26: warning: unused parameter 'val' [-Wunused-parameter]
   38 | int updateY(int pos, int val) {
      |                      ~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 21 ms 348 KB Output is correct
3 Correct 20 ms 476 KB Output is correct
4 Correct 20 ms 348 KB Output is correct
5 Correct 20 ms 476 KB Output is correct
6 Correct 20 ms 344 KB Output is correct
7 Correct 20 ms 476 KB Output is correct
8 Correct 20 ms 344 KB Output is correct
9 Correct 20 ms 476 KB Output is correct
10 Correct 21 ms 348 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 14 ms 604 KB Output is correct
14 Correct 3 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 20 ms 472 KB Output is correct
17 Correct 12 ms 344 KB Output is correct
18 Correct 8 ms 348 KB Output is correct
19 Correct 12 ms 348 KB Output is correct
20 Correct 20 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 21 ms 348 KB Output is correct
3 Correct 20 ms 348 KB Output is correct
4 Correct 20 ms 348 KB Output is correct
5 Correct 21 ms 348 KB Output is correct
6 Correct 21 ms 348 KB Output is correct
7 Correct 21 ms 348 KB Output is correct
8 Correct 20 ms 472 KB Output is correct
9 Correct 21 ms 344 KB Output is correct
10 Correct 21 ms 472 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 2 ms 444 KB Output is correct
13 Correct 15 ms 460 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 5 ms 444 KB Output is correct
16 Correct 20 ms 476 KB Output is correct
17 Correct 12 ms 432 KB Output is correct
18 Correct 9 ms 348 KB Output is correct
19 Correct 12 ms 452 KB Output is correct
20 Correct 20 ms 472 KB Output is correct
21 Incorrect 20 ms 348 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 256 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 20 ms 348 KB Output is correct
3 Correct 20 ms 348 KB Output is correct
4 Correct 20 ms 348 KB Output is correct
5 Correct 21 ms 344 KB Output is correct
6 Correct 20 ms 348 KB Output is correct
7 Correct 20 ms 472 KB Output is correct
8 Correct 20 ms 476 KB Output is correct
9 Correct 20 ms 348 KB Output is correct
10 Correct 20 ms 348 KB Output is correct
11 Correct 4 ms 440 KB Output is correct
12 Correct 3 ms 344 KB Output is correct
13 Correct 14 ms 460 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 20 ms 472 KB Output is correct
17 Correct 12 ms 344 KB Output is correct
18 Correct 9 ms 348 KB Output is correct
19 Correct 12 ms 456 KB Output is correct
20 Correct 20 ms 344 KB Output is correct
21 Incorrect 21 ms 344 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 20 ms 348 KB Output is correct
3 Correct 20 ms 468 KB Output is correct
4 Correct 21 ms 348 KB Output is correct
5 Correct 21 ms 348 KB Output is correct
6 Correct 20 ms 344 KB Output is correct
7 Correct 21 ms 604 KB Output is correct
8 Correct 21 ms 348 KB Output is correct
9 Correct 20 ms 344 KB Output is correct
10 Correct 20 ms 480 KB Output is correct
11 Correct 4 ms 348 KB Output is correct
12 Correct 2 ms 436 KB Output is correct
13 Correct 14 ms 464 KB Output is correct
14 Correct 2 ms 344 KB Output is correct
15 Correct 5 ms 348 KB Output is correct
16 Correct 20 ms 472 KB Output is correct
17 Correct 13 ms 460 KB Output is correct
18 Correct 8 ms 436 KB Output is correct
19 Correct 12 ms 348 KB Output is correct
20 Correct 21 ms 472 KB Output is correct
21 Incorrect 21 ms 604 KB Output isn't correct
22 Halted 0 ms 0 KB -