# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
652465 | 2022-10-22T17:15:23 Z | Blagoj | 메기 농장 (IOI22_fish) | C++17 | 104 ms | 7268 KB |
#include "fish.h" #include <bits/stdc++.h> using namespace std; long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { bool Even = true, Less = true; long long sum1 = 0, sum2 = 0; for (auto x : X) { if (x % 2 != 0) { Even = false; } if (x > 1) { Less = false; } } if (Even) { long long sum = 0; for (auto x : W) { sum += x; } return sum; } if (Less) { long long m[N + 3][3]; memset(m, 0, sizeof(m)); for (int i = 0; i < M; i++) { m[Y[i]][X[i]] = W[i]; } for (int i = 1; i < N; i++) { m[i][0] += m[i - 1][0]; m[i][1] += m[i - 1][1]; } long long ans = 0; for (int i = 0; i < N; i++) { ans = max(ans, m[i][0] + m[N - i][1]); } return ans; } long long dp[N + 3], p[N + 3]; memset(dp, 0, sizeof(dp)); memset(p, 0, sizeof(p)); for (int i = 0; i < M; i++) { p[X[i]] = W[i]; } dp[0] = 0; dp[1] = max(p[0], p[1]); for (int i = 2; i < M; i++) { dp[i] = max(dp[i - 2] + p[i], dp[i - 1]); } return dp[M - 1]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 2124 KB | Output is correct |
2 | Correct | 29 ms | 2640 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 104 ms | 7268 KB | Output is correct |
6 | Correct | 93 ms | 7264 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 49 ms | 6168 KB | 1st lines differ - on the 1st token, expected: '40604614618209', found: '40548887115777' |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 1748 KB | 1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '3', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '3', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | 1st lines differ - on the 1st token, expected: '3', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 1748 KB | 1st lines differ - on the 1st token, expected: '882019', found: '0' |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 2124 KB | Output is correct |
2 | Correct | 29 ms | 2640 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 104 ms | 7268 KB | Output is correct |
6 | Correct | 93 ms | 7264 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Incorrect | 49 ms | 6168 KB | 1st lines differ - on the 1st token, expected: '40604614618209', found: '40548887115777' |
9 | Halted | 0 ms | 0 KB | - |