답안 #870471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
870471 2023-11-08T03:01:20 Z HuyQuang_re_Zero 꿈 (IOI13_dreaming) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define II pair <ll,ll>
#define III pair <ll,II>
#define IV pair <vector <int>,vector <int> >
#define fst first
#define snd second
#define BIT(x,i) ((x>>i)&1)
#define pi acos(-1)
#define to_radian(x) (x*pi/180.0)
#define to_degree(x) (x*180.0/pi)
#define Log(x) (31-__builtin_clz((int)x))
#define LogLL(x) (63-__builtin_clzll((ll)x))
#define N 100005
#include "dreaming.h"
using namespace std;
struct International_Olympiad_in_Informatics
{
    vector <II> a[N];
    int n,m,i,mi,mx_each,w[N],comp,f[N],u,v,k;
    void dfs(int u,int p)
    {
        vector <int> vec;
        vec.push_back(0); vec.push_back(0);
        for(II adj:a[u])
        {
            int v=adj.fst,k=adj.snd;
            if(v==p) continue;
            dfs(v,u);
            vec.push_back(f[v]+k);
        }
        sort(vec.rbegin(),vec.rend());
        f[u]=vec[0];
    }
    void DFS(int u,int p)
    {
        vector <int> vec;
        vec.push_back(0); vec.push_back(0);
        for(II adj:a[u])
        {
            int v=adj.fst,k=adj.snd;
            vec.push_back(f[v]+k);
        }
        sort(vec.rbegin(),vec.rend());
        mx_each=max(mx_each,vec[0]+vec[1]);
        f[u]=vec[0];
        mi=min(mi,f[u]);
        for(II adj:a[u])
        {
            int v=adj.fst,k=adj.snd;
            if(v==p) continue;
            f[u]=vec[vec[0]==f[v]+k];
            DFS(v,u);
        }
    }
    int Work(int _n,int m,int l,int U[],int V[],int W[])
    {
        n=_n;
        for(i=0;i<m;i++)
        {
            u=U[i]; v=V[i]; k=W[i];
            u++; v++;
            a[u].push_back({ v,k }); a[v].push_back({ u,k });
        }

        memset(f,-1,sizeof(f));
        mx_each=0;
        for(u=1;u<=n;u++)
            if(f[u]==-1)
            {
                mi=round(2e9);
                dfs(u,0);
                DFS(u,0);
                w[++comp]=mi;
            }
        sort(w+1,w+comp+1);
        if(comp==1) return mx_each;
        if(comp==2) return max(mx_each,w[1]+w[2]+l);
        return max(mx_each,max(w[comp-1]+w[comp]+l,w[comp-2]+w[comp-1]+2*l));
    }
} IOI;


int travelTime(int _n,int m,int l,int U[],int V[],int W[])
{
    return IOI.Work(_n,m,l,U,V,W);
}
/*
int main()
{
    freopen("dreaming.inp","r",stdin);
    freopen("dreaming.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n,m,l,U[102],V[102],W[102];
    cin>>n>>m>>l;
    for(int i=0;i<m;i++) cin>>U[i];
    for(int i=0;i<m;i++) cin>>V[i];
    for(int i=0;i<m;i++) cin>>W[i];
    cout<<travelTime(n,m,l,U,V,W);
}
*/

Compilation message

dreaming.cpp:15:11: error: expected ',' or '...' before numeric constant
   15 | #define N 100005
      |           ^~~~~~
dreaming.h:8:20: note: in expansion of macro 'N'
    8 | int travelTime(int N, int M, int L, int A[], int B[], int T[]);
      |                    ^