# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1045563 | phoenix0423 | Chase (CEOI17_chase) | C++17 | 141 ms | 179056 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
// #pragma GCC optimize("Ofast")
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define int long long
#define lowbit(x) x&-x
const int maxn = 1e5 + 5;
const int INF = 4e18;
const int N = 998244353;
int dp[maxn][105][2];
vector<int> adj[maxn];
int p[maxn], deg[maxn];
int n, v, ans = 0;
void dfs(int pos, int prev){
dp[pos][1][0] = deg[pos];
dp[pos][1][1] = deg[pos] - p[pos];
for(int i = 2; i <= v; i++) dp[pos][i][0] = dp[pos][i - 1][0], dp[pos][i][1] = dp[pos][i - 1][1];
ans = max(ans, dp[pos][1][1]);
for(auto x : adj[pos]){
if(x == prev) continue;
dfs(x, pos);
for(int i = 1; i < v; i++){
ans = max(ans, dp[x][i][1] + dp[pos][v - i][0] - p[x] - p[pos]);
# | 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... |