제출 #1201544

#제출 시각아이디문제언어결과실행 시간메모리
1201544mr_junk자매 도시 (APIO20_swap)C++17
컴파일 에러
0 ms0 KiB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int>> g[1e6];
int used[N];
int mx,check;
void dfs(int v){
	if (check){
		return;
	}
	used[v]=1;
	for(auto it : g[v]){
		if (used[it.first]==1){
			check=true;
		}else{
			dfs(it.first);
		}
	}used[v]=2;
}
void init(int N, int M,
          std::vector<int> U, std::vector<int> V, std::vector<int> W) {
        
	for(int i=0;i<M;i++){
		g[U[i]].push_back({V[i],W[i]});
		g[V[i]].push_back({U[i],W[i]});
		mx=max(mx,W[i]);
	}dfs(1);

}int getMinimumFuelCapacity(int X, int Y) {
	if (check)return mx;
  return -1;
}

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

swap.cpp:4:25: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 | vector<pair<int,int>> g[1e6];
      |                         ^~~
swap.cpp:4:25: error: could not convert '1.0e+6' from 'double' to 'long unsigned int'
    4 | vector<pair<int,int>> g[1e6];
      |                         ^~~
      |                         |
      |                         double
swap.cpp:4:25: error: size of array 'g' has non-integral type 'double'
swap.cpp:5:10: error: 'N' was not declared in this scope
    5 | int used[N];
      |          ^
swap.cpp: In function 'void dfs(int)':
swap.cpp:11:9: error: 'used' was not declared in this scope
   11 |         used[v]=1;
      |         ^~~~