Submission #519172

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5191722022-01-25 19:55:11MOUF_MAHMALATTorrent (COI16_torrent)C++14
31 / 100
2078 ms23044 KiB
#include<bits/stdc++.h>
#define all(s) s.begin(),s.end()
#define F first
#define S second
using namespace std;
typedef int ll;
ll n,a,b,x,y,dp[300009],pp[300009],ans=1e9;
vector<vector<ll> >v;
vector<ll>bin;
inline void dfs(ll d,ll p)
{
pp[d]=p;
for(auto&z:v[d])
if(z!=p)
dfs(z,d);
}
inline void best(ll d,ll p)
{
dp[d]=0;
vector<ll>o;
for(auto&z:v[d])
{
if(z==p||(d==x&&z==y)||(d==y&&z==x))
continue;
best(z,d);
o.push_back(dp[z]);
}
sort(all(o),greater<ll>());
for(ll i=0; i<o.size(); i++)
dp[d]=max(dp[d],o[i]+i+1);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

torrent.cpp: In function 'void best(ll, ll)':
torrent.cpp:29:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(ll i=0; i<o.size(); i++)
      |                 ~^~~~~~~~~
torrent.cpp: In function 'int main()':
torrent.cpp:52:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     for(ll i=0;i<bin.size()-1;i++)
      |                ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...