Submission #565812

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5658122022-05-21 11:04:49shahriarkhanVillage (BOI20_village)C++14
50 / 100
142 ms39840 KiB
#include<bits/stdc++.h>
using namespace std ;
const int MX = 1e5 + 5 , INF = 1e9 + 5 , LG = 25 ;
int dp[MX][2] , mn[MX] ;
vector<int> adj[MX] ;
vector<pair<int,int> > pick[MX][2] ;
void dfs(int s , int p)
{
int sum = 0 , good = 0 , leaf = 1 , rd = 0 , pos = 0 , idx = 0 ;
dp[s][0] = 0 , dp[s][1] = INF ;
for(int t : adj[s])
{
if(t==p) continue ;
dfs(t,s) , leaf = 0 ;
dp[s][0] = min(dp[s][0] + dp[t][1] , INF) , pick[s][0].push_back({t,1}) ;
if((dp[t][0]+2)<=dp[t][1])
{
sum += dp[t][0] + 2 , pick[s][1].push_back({t,0}) , ++pos ;
good = 1 ;
}
else
{
if(dp[t][0]<dp[t][1])
{
rd = t ;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

Village.cpp: In function 'int main()':
Village.cpp:145:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  145 |     scanf("%d",&n) ;
      |     ~~~~~^~~~~~~~~
Village.cpp:149:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  149 |         scanf("%d%d",&x,&y) ;
      |         ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...