제출 #1162868

#제출 시각아이디문제언어결과실행 시간메모리
1162868tsengang경주 (Race) (IOI11_race)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "race.h"
using namespace std;
#define ll int
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ertunt return
#define vodka void
vector<pair<int,int>>v[1000006];
ll ans = 1e9;
bool vis[1e6];
vodka dfs(ll x,vector<int>q,ll cur,ll k){
    if(vis[x])ertunt;
    vis[x] = 1;
    if(cur == k)ans = min(ans,(ll)q.size());
    while(cur > k){
        cur -= q[0];
        q.erase(q.begin());
    }
    for(auto [z,y] : v[x]){
        vector<int> g = q;
        g.pb(y);
        dfs(z,g,cur+y,k);
    }
}
int best_path(int n,int k,int h[][2],int l[]){
    for(ll i = 0; i < n-1; i++){
        v[h[i][0]].pb({h[i][1],l[i]});
        v[h[i][1]].pb({h[i][0],l[i]});
    }
    vector<int>d;
    for(ll i = 0; i < n; i++){
        if(v[i].size() == 1)d.pb(i);
    }
    for(auto i : d){
        vector<int>f;
        dfs(i,f,0,k);
        fill(vis,vis+n+5,0);
    }
    ertunt ans;
}

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

race.cpp:13:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   13 | bool vis[1e6];
      |          ^~~
race.cpp:13:10: error: could not convert '1.0e+6' from 'double' to 'long unsigned int'
   13 | bool vis[1e6];
      |          ^~~
      |          |
      |          double
race.cpp:13:10: error: size of array 'vis' has non-integral type 'double'