이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define vt vector
#define pb push_back
#define ar array
#define all(x) (x).begin(), (x).end()
#define sz(x) (x).size()
using namespace std;
/*
1. simplify
2. add new elements
3. brute force solution
4. optimize
*/
// --- templates ---
// --- code ---
ll max_weights(int n, int m, vt<int> X, vt<int> Y, vt<int> W){
vt<ll> a(n);
for(int i = 0; i < m; i++){
a[X[i]] = W[i];
}
vt<ll> dp(n);
for(int i = 0; i < n; i++){
dp[i] = max((i ? a[i - 1] : 0) + (i >= 2 ? dp[i - 2] : 0) + (i == n - 2 ? a[i + 1] : 0),
(i ? dp[i - 1] : 0));
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |