Submission #540625

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5406252022-03-21 08:58:59AlperenTParkovi (COCI22_parkovi)C++17
110 / 110
1915 ms44056 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const long long INF = 2e18 + 5;
int n, k, a, b, c;
long long l, r, m, park[N], nongood[N];
bool ispark[N];
vector<pair<int, long long>> tree[N];
void dfs(int v, int p, int pw, long long x){
if(tree[v].size() == 1) nongood[v] = 0;
for(auto e : tree[v]){
if(e.first != p){
dfs(e.first, v, e.second, x);
park[v] = min(park[v], park[e.first] + e.second);
}
}
for(auto e : tree[v]){
if(e.first != p){
if(nongood[e.first] + e.second + park[v] > x){
nongood[v] = max(nongood[v], nongood[e.first] + e.second);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:77:59: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   77 |     for(int i = 1; i <= n; i++) if(!ispark[i] && v.size() < k) v.push_back(i);
      |                                                  ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...