# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
833956 | MODDI | Magic Tree (CEOI19_magictree) | C++14 | 114 ms | 29464 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int,int> pii;
typedef vector<long long> vl;
typedef vector<int> vi;
int n, m, k;
vi G[100100];
vector<pll> fruits;
map<int, int> dp[100100];
void dfs(int node, int p){
// cout<<"AT: "<<node<<endl;
for(auto next : G[node]){
if(next !=p){
dfs(next, node);
if(dp[node].size() < dp[next].size()) swap(dp[node], dp[next]);
for(auto t : dp[next]) dp[node][t.first] += t.second;
}
}
if(fruits[node].first != -1){
ll hold = fruits[node].second;
while(hold > 0){
auto rem = dp[node].upper_bound(fruits[node].first);
if(rem == dp[node].end()) break;
if(rem->second <= hold){
hold -= rem->second;
dp[node].erase(rem);
# | 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... |