제출 #585395

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
5853952022-06-28 19:42:18MrDeboo경주 (Race) (IOI11_race)C++17
100 / 100
446 ms130800 KiB
#include "race.h"
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>>vct[500000];
pair<pair<long long,long long>,map<long long,long long>>pr[500000];
long long ans=LONG_LONG_MAX,k;
vector<int>viss(500000);
int cnt=0;
void dfs(int in){
cnt++;
assert(!viss[in]);
viss[in]=1;
if(vct[in].empty()){
pr[in].second[0]=0;
return;
}
for(auto &i:vct[in])dfs(i.first);
int f=0,g=0;
for(int i=0;i<vct[in].size();i++){
if(pr[vct[in][i].first].second.size()>f){
f=pr[vct[in][i].first].second.size();
g=i;
}
}
swap(pr[in],pr[vct[in][g].first]);
pr[in].first.first+=vct[in][g].second;
pr[in].first.second++;
if(!pr[in].second.count(-pr[in].first.first))pr[in].second[-pr[in].first.first]=-pr[in].first.second;
else pr[in].second[-pr[in].first.first]=min(pr[in].second[-pr[in].first.first],-pr[in].first.second);
if(pr[in].second.count(k-pr[in].first.first)){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

race.cpp: In function 'void dfs(int)':
race.cpp:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=0;i<vct[in].size();i++){
      |                 ~^~~~~~~~~~~~~~~
race.cpp:20:46: warning: comparison of integer expressions of different signedness: 'std::map<long long int, long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |         if(pr[vct[in][i].first].second.size()>f){
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
race.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i=0;i<vct[in].size();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...