Submission #1096100

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10961002024-10-03 18:34:110pt1mus23Parkovi (COCI22_parkovi)C++14
0 / 110
2 ms604 KiB
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long int
#define ins insert
#define pb push_back
#define putr(x) cout<<x<<endl;return;
#define all(x) x.begin(),x.end()
#define _ << " " <<
const int mod = 1e9+7 ,
sze= 500 ,
inf = 1e15,
L = 31 ;
vector<pair<int,int>> graph[sze];
vector<int> alst;
int dp[sze][2];
void dfs(int node,int par,int mid){
for(auto [a,b]:graph[node]){
if(a!=par){
dfs(a,node,mid);
dp[node][0] = min(dp[node][0],dp[a][0] + b);
if(dp[a][1] + b <= mid){
dp[node][1]=max(dp[node][1],dp[a][1] + b);
}
else{
// cout<<mid<<" => "<<a<<endl;
alst.pb(a);
dp[node][0]=min(dp[node][0],b);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

Main.cpp: In function 'void dfs(long long int, long long int, long long int)':
Main.cpp:18:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   18 |     for(auto [a,b]:graph[node]){
      |              ^
Main.cpp: In function 'void opt1z()':
Main.cpp:83:20: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   83 |         if(a.size()<k && a.find(i)==a.end()){
      |            ~~~~~~~~^~
Main.cpp:89:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   89 |     for(auto v:a) cout<<v<<" ";cout<<endl;
      |     ^~~
Main.cpp:89:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   89 |     for(auto v:a) cout<<v<<" ";cout<<endl;
      |                                ^~~~
Main.cpp: In function 'long long int check(long long int)':
Main.cpp:41:17: warning: iteration 500 invokes undefined behavior [-Waggressive-loop-optimizations]
   41 |         dp[i][0]=(int)2e14;
      |         ~~~~~~~~^~~~~~~~~~
Main.cpp:40:18: note: within this loop
   40 |     for(int i=0;i<=sze;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...