답안 #782856

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
782856 2023-07-14T10:28:14 Z vjudge1 사이버랜드 (APIO23_cyberland) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
//#define int long long
//#define mid (start+end)/2
//#define OYY 10000
//#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);
const long double OYY=1e100;

double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int>y, std::vector<int> c, std::vector<int> arr){
    int n=N;
    int m=M;
    int k=K;
    vector <vector<pair<long long int,long long int>>> v;
    v.assign(n,{});
    k=min(k,70);
    for(int i=0;i<m;i++){
        int a=x[i];
        int b=y[i];
        int co=c[i];
        v[a].push_back({b,co});
        v[b].push_back({a,co});
    }
    vector <long double> uza(n,OYY);
    uza[0]=0;
    for(int ip=0;ip<=k+2;ip++){
        set <pair<long double,int>> st;
        for(int i=0;i<n;i++){
            st.emplace({uza[i],i});
        }
        while(st.size()){
            int node=st.begin()->second;
            st.erase(st.begin());
            if(node==H)continue;
            for(int i=0;i<v[node].size();i++){
                int go=v[node][i].first;
                int cost=v[node][i].second;
                if(uza[go]>uza[node]+cost){
                    st.erase({uza[go],go});
                    uza[go]=uza[node]+cost;
                    st.insert({uza[go],go});
                }
            }
        }
        auto ne=uza;
        for(int j=0;j<n;j++){
            if(uza[j]<OYY/10){
                if(arr[j]==0)ne[j]=0;
            }
            else if(arr[j]==2 && ip>1 && ip!=k+2){
                for(int i=0;i<v[j].size();i++){
                    int go=v[j][i].first;
                    int cost=v[j][i].second;
                    ne[go]=min(ne[go],uza[j]/2+(long double)cost);
                }
            }
        }
        uza=ne;
    }
    if(uza[H]<OYY/10){
        return uza[H];
    }
    return -1;
}

Compilation message

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:28:34: error: no matching function for call to 'std::set<std::pair<long double, int> >::emplace(<brace-enclosed initializer list>)'
   28 |             st.emplace({uza[i],i});
      |                                  ^
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_set.h:462:2: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::emplace(_Args&& ...) [with _Args = {}; _Key = std::pair<long double, int>; _Compare = std::less<std::pair<long double, int> >; _Alloc = std::allocator<std::pair<long double, int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<std::pair<long double, int>, std::pair<long double, int>, std::_Identity<std::pair<long double, int> >, std::less<std::pair<long double, int> >, std::allocator<std::pair<long double, int> > >::const_iterator]'
  462 |  emplace(_Args&&... __args)
      |  ^~~~~~~
/usr/include/c++/10/bits/stl_set.h:462:2: note:   candidate expects 0 arguments, 1 provided
cyberland.cpp:34:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |             for(int i=0;i<v[node].size();i++){
      |                         ~^~~~~~~~~~~~~~~
cyberland.cpp:50:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |                 for(int i=0;i<v[j].size();i++){
      |                             ~^~~~~~~~~~~~