답안 #628112

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
628112 2022-08-13T05:26:31 Z TheQuantiX 메기 농장 (IOI22_fish) C++17
3 / 100
84 ms 8820 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

ll n, m, x, y, k;

ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> k) {
    vector<ll> v(n);
    for (int i = 0; i < m; i++) {
        v[x[i]] += k[i];
    }
    vector<ll> dp(n + 1);
    for (int i = 1; i <= n; i++) {
        dp[i] = v[i - 1];
        if (i >= 2) {
            dp[i] = max(dp[i], dp[i - 2] + v[i - 1]);
        }
        if (i >= 3) {
            dp[i] = max(dp[i], dp[i - 3] + v[i - 1]);
        }
//        cout << dp[i] << '\n';
    }
    return *max_element(dp.begin(), dp.end());
}

//void solve() {
//    cin >> n >> m;
//    vector<int> x(m);
//    vector<int> y(m);
//    vector<int> k(m);
//    for (int i = 0; i < m; i++) {
//        cin >> x[i] >> y[i] >> k[i];
//    }
//    cout << max_weights(n, m, x, y, k) << '\n';
//}
//
//int main() {
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
//    cout.tie(0);
//    solve();
//}
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 3540 KB Output is correct
2 Correct 27 ms 4160 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 83 ms 8820 KB Output is correct
6 Correct 84 ms 8808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1748 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Incorrect 15 ms 2864 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341'
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 1 ms 1748 KB Output is correct
2 Correct 1 ms 1876 KB Output is correct
3 Incorrect 15 ms 2864 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 3540 KB Output is correct
2 Correct 27 ms 4160 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 1 ms 1876 KB Output is correct
5 Correct 83 ms 8820 KB Output is correct
6 Correct 84 ms 8808 KB Output is correct
7 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
8 Halted 0 ms 0 KB -