제출 #924683

#제출 시각아이디문제언어결과실행 시간메모리
924683Dzadzo전선 연결 (IOI17_wiring)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "wiring.h" #define ll long long #define int ll #define pb push_back #define S second #define F first #define pii pair<int,int> #define vi vector <int> #define vvi vector <vi> #define vvvi vector <vvi> #define vp vector <pii> #define vvp vector <vp> #define vb vector <bool> #define vvb vector <vb>; #define INF LLONG_MAX #define MOD 1000000007 __int32 #define MAXN 100000 using namespace std; long long min_total_length(std::vector<__int32> r, std::vector<__int32> b){ vp v; v.pb({0,0}); for (auto x:r)v.pb({x*1ll,-1*1ll}); for (auto x:b)v.pb({x*1ll,1ll}); int n=v.size()-1; sort(v.begin()+1,v.end()); vi dp(n+1,INF),p(n+1); dp[0]=0; for (int i=1;i<=n;i++){ p[i]=p[i-1]+v[i].F; } int cur=1,prev=0; while (v[prev].S==v[prev+1].S)cur++; int ind; for (int i=cur+1;i<=n;i++){ if (v[i].S!=v[i-1].S){ ind=v[i-1].F; for (int j=i-cur;j<i;j++)if (dp[j-1]!=INF)dp[j]=min(dp[j],dp[j-1]+v[i].F-v[j].F); prev=cur; cur=0; } cur++; if (dp[i-1]!=INF) dp[i]=min(dp[i],dp[i-1]+v[i].F-ind); if (cur<=prev && dp[i-2*cur]!=INF)dp[i]=min(dp[i],dp[i-2*cur]+p[i]+p[i-2*cur]-2*p[i-cur]); } return dp[n]; }

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

wiring.cpp:21:40: error: '__int32' was not declared in this scope; did you mean '__rintf32'?
   21 | long long min_total_length(std::vector<__int32> r, std::vector<__int32> b){
      |                                        ^~~~~~~
      |                                        __rintf32
wiring.cpp:21:47: error: template argument 1 is invalid
   21 | long long min_total_length(std::vector<__int32> r, std::vector<__int32> b){
      |                                               ^
wiring.cpp:21:47: error: template argument 2 is invalid
wiring.cpp:21:64: error: '__int32' was not declared in this scope; did you mean '__rintf32'?
   21 | long long min_total_length(std::vector<__int32> r, std::vector<__int32> b){
      |                                                                ^~~~~~~
      |                                                                __rintf32
wiring.cpp:21:71: error: template argument 1 is invalid
   21 | long long min_total_length(std::vector<__int32> r, std::vector<__int32> b){
      |                                                                       ^
wiring.cpp:21:71: error: template argument 2 is invalid
wiring.cpp: In function 'long long int min_total_length(int, int)':
wiring.cpp:24:14: error: 'begin' was not declared in this scope
   24 |  for (auto x:r)v.pb({x*1ll,-1*1ll});
      |              ^
wiring.cpp:24:14: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from wiring.cpp:1:
/usr/include/c++/10/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from wiring.cpp:1:
/usr/include/c++/10/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
wiring.cpp:24:14: error: 'end' was not declared in this scope
   24 |  for (auto x:r)v.pb({x*1ll,-1*1ll});
      |              ^
wiring.cpp:24:14: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from wiring.cpp:1:
/usr/include/c++/10/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from wiring.cpp:1:
/usr/include/c++/10/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~
wiring.cpp:24:35: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   24 |  for (auto x:r)v.pb({x*1ll,-1*1ll});
      |                                   ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wiring.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
wiring.cpp:25:14: error: 'begin' was not declared in this scope
   25 |  for (auto x:b)v.pb({x*1ll,1ll});
      |              ^
wiring.cpp:25:14: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from wiring.cpp:1:
/usr/include/c++/10/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from wiring.cpp:1:
/usr/include/c++/10/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
wiring.cpp:25:14: error: 'end' was not declared in this scope
   25 |  for (auto x:b)v.pb({x*1ll,1ll});
      |              ^
wiring.cpp:25:14: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from wiring.cpp:1:
/usr/include/c++/10/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from wiring.cpp:1:
/usr/include/c++/10/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~
wiring.cpp:25:32: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(<brace-enclosed initializer list>)'
   25 |  for (auto x:b)v.pb({x*1ll,1ll});
      |                                ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wiring.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~