제출 #1365634

#제출 시각아이디문제언어결과실행 시간메모리
1365634abmr59경주 (Race) (IOI11_race)C++20
컴파일 에러
0 ms0 KiB
#include "race.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
const int maxn=200004;
int n,k,ans=-1,dep[maxn],wet[maxn];
map<int,int> ma[maxn];
vector<pair<int,int>> v[maxn];

void check(int i,int wa,int wl,int da,int dl)
{
    int j=k-wa+2wl;
    if(ma[i].count(j))
    {
        int g=da+ma[i][j]-2dl;
        if(ans==-1ans>g)
        {
            ans=g;
        }
    }
}

void mer(int i,int w,int d)
{
    if(ma[i].count(w))
    {
        if(ma[i][w]>d)
        {
            ma[i][w]=d;
        }
    }
    else
    {
        ma[i][w]=d;
    }
}

void df(int i,int j)
{
    dep[i]=dep[j]+1;
    int m=-1;
    for(auto [k,w] : v[i])
    {
        if(k!=j)
        {
            wet[k]=wet[i]+w;
            df(k,i);
            if(m==-1ma[k].size()>=ma[m].size())
            {
                m=k;
            }
        }
    }

    if(m!=-1)
    {
        swap(ma[i],ma[m]);
    }

    check(i,wet[i],wet[i],dep[i],dep[i]);
    mer(i,wet[i],dep[i]);

    for(auto [k,w] : v[i])
    {
        if(k!=j&&k!=m)
        {
            for(auto [we,de] : ma[k])
            {
                check(i,we,wet[i],de,dep[i]);
            }
            for(auto [we,de] : ma[k])
            {
                mer(i,we,de);
            }
        }
    }



}



int best_path(int N,int K,int H[][2],int L[])
{
    k=K;
    for(int i=0;i<N-1;i++)
    {
        int v1,v2,w;
        v1=H[i][0];
        v2=H[i][1];
        w=L[i];
        v[v1].push_back({v2,w});
        v[v2].push_back({v1,w});
    }

    df(0,N+7);


    return ans;
}

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

race.cpp: In function 'void check(long long int, long long int, long long int, long long int, long long int)':
race.cpp:13:16: error: unable to find numeric literal operator 'operator""wl'
   13 |     int j=k-wa+2wl;
      |                ^~~
race.cpp:16:27: error: unable to find numeric literal operator 'operator""dl'
   16 |         int g=da+ma[i][j]-2dl;
      |                           ^~~
race.cpp:17:18: error: unable to find numeric literal operator 'operator""ans'
   17 |         if(ans==-1ans>g)
      |                  ^~~~
race.cpp: In function 'void df(long long int, long long int)':
race.cpp:49:20: error: unable to find numeric literal operator 'operator""ma'
   49 |             if(m==-1ma[k].size()>=ma[m].size())
      |                    ^~~