이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
/// #pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
const int MOD = 998244353;
int DP[100001][2];
int findSample(int N, int* confidence,
int* host, int* protocol) {
for(int l = 0; l < N; l++)
DP[l][1] = confidence[l];
for(int l = N - 1; l > 0; l--) {
int t = protocol[l];
if(t == 0) {
DP[host[l]][0] += DP[l][1];
DP[host[l]][1] += DP[l][0];
}
if(t == 1) {
DP[host[l]][1] += DP[l][1];
DP[host[l]][0] += DP[l][0];
}
if(t == 2) {
DP[host[l]][1] = max(DP[host[l]][0] + DP[l][1], DP[host[l]][1] + DP[l][0]);
DP[host[l]][0] += DP[l][0];
}
DP[host[l]][1] = max(DP[host[l]][1], DP[host[l]][0]);
}
return max(DP[0][0], DP[0][1]);
}
# | 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... |