| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1325431 | exoworldgd | Crocodile's Underground City (IOI11_crocodile) | C++20 | 컴파일 에러 | 0 ms | 0 KiB |
#include"crocodile.h"
#include<bits/stdc++.h>
#define exoworldgd cin.tie(0)->sync_with_stdio(0),cout.tie(0)
#define ll long long
#define A array<int,2>
using namespace std;
int travel_plan(int N,int M,int R[][2],int L[],int K,int P[]){
A a[N];
vector<A>g[N];
priority_queue<A,vector<A>,greater<>>pq;
bool vs[N];
for(int i=0;i<N;i++)a[i]={(int)1e9,(int)1e9};
for(int i=0;i<M;i++)g[R[i][0]].emplace_back(R[i][1],L[i]),g[R[i][1]].emplace_back(R[i][0],L[i]);
for(int i=0;i<K;i++)a[P[i]]={0,0},pq.emplace(0,P[i]);
while(pq.size()){
auto[d,u]=pq.top();pq.pop();
if(vs[u])continue;
vs[u]=1;
for(auto[v,w]:g[u]){
if(d+w<a[v][1]){
a[v][1]=d+w;
if(a[v][1]<a[v][0])swap(a[v][0],a[v][1]);
if(a[v][1]<(int)1e9)pq.emplace(a[v][1],v);
}
}
}
return a[0][1];
}컴파일 시 표준 에러 (stderr) 메시지
In file included from /usr/include/c++/13/ext/alloc_traits.h:34,
from /usr/include/c++/13/bits/basic_string.h:39,
from /usr/include/c++/13/string:54,
from /usr/include/c++/13/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
from crocodile.cpp:2:
/usr/include/c++/13/bits/alloc_traits.h: In instantiation of 'static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::array<int, 2>; _Args = {int&, int&}; _Tp = std::array<int, 2>; allocator_type = std::allocator<std::array<int, 2> >]':
/usr/include/c++/13/bits/vector.tcc:117:30: required from 'constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int&, int&}; _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >; reference = std::array<int, 2>&]'
crocodile.cpp:13:45: required from here
/usr/include/c++/13/bits/alloc_traits.h:540:28: error: no matching function for call to 'construct_at(std::array<int, 2>*&, int&, int&)'
540 | std::construct_at(__p, std::forward<_Args>(__args)...);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/bits/stl_iterator.h:85,
from /usr/include/c++/13/bits/stl_algobase.h:67,
from /usr/include/c++/13/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51:
/usr/include/c++/13/bits/stl_construct.h:94:5: note: candidate: 'template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...)'
94 | construct_at(_Tp* __location, _Args&&... __args)
| ^~~~~~~~~~~~
/usr/include/c++/13/bits/stl_construct.h:94:5: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_construct.h: In substitution of 'template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = std::array<int, 2>; _Args = {int&, int&}]':
/usr/include/c++/13/bits/alloc_traits.h:540:21: required from 'static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::array<int, 2>; _Args = {int&, int&}; _Tp = std::array<int, 2>; allocator_type = std::allocator<std::array<int, 2> >]'
/usr/include/c++/13/bits/vector.tcc:117:30: required from 'constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int&, int&}; _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >; reference = std::array<int, 2>&]'
crocodile.cpp:13:45: required from here
/usr/include/c++/13/bits/stl_construct.h:96:17: error: array must be initialized with a brace-enclosed initializer
96 | -> decltype(::new((void*)0) _Tp(std::declval<_Args>()...))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/alloc_traits.h: In instantiation of 'static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::array<int, 2>; _Args = {int, int&}; _Tp = std::array<int, 2>; allocator_type = std::allocator<std::array<int, 2> >]':
/usr/include/c++/13/bits/vector.tcc:117:30: required from 'constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int, int&}; _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >; reference = std::array<int, 2>&]'
/usr/include/c++/13/bits/stl_queue.h:756:18: required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {int, int&}; _Tp = std::array<int, 2>; _Sequence = std::vector<std::array<int, 2> >; _Compare = std::greater<void>]'
crocodile.cpp:14:46: required from here
/usr/include/c++/13/bits/alloc_traits.h:540:28: error: no matching function for call to 'construct_at(std::array<int, 2>*&, int, int&)'
540 | std::construct_at(__p, std::forward<_Args>(__args)...);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_construct.h:94:5: note: candidate: 'template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...)'
94 | construct_at(_Tp* __location, _Args&&... __args)
| ^~~~~~~~~~~~
/usr/include/c++/13/bits/stl_construct.h:94:5: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_construct.h: In substitution of 'template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = std::array<int, 2>; _Args = {int, int&}]':
/usr/include/c++/13/bits/alloc_traits.h:540:21: required from 'static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::array<int, 2>; _Args = {int, int&}; _Tp = std::array<int, 2>; allocator_type = std::allocator<std::array<int, 2> >]'
/usr/include/c++/13/bits/vector.tcc:117:30: required from 'constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int, int&}; _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >; reference = std::array<int, 2>&]'
/usr/include/c++/13/bits/stl_queue.h:756:18: required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {int, int&}; _Tp = std::array<int, 2>; _Sequence = std::vector<std::array<int, 2> >; _Compare = std::greater<void>]'
crocodile.cpp:14:46: required from here
/usr/include/c++/13/bits/stl_construct.h:96:17: error: array must be initialized with a brace-enclosed initializer
96 | -> decltype(::new((void*)0) _Tp(std::declval<_Args>()...))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~