# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
862673 | neki | Catfish Farm (IOI22_fish) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define vc vector
using namespace std;
ll max_weights(int N, int M, vc<int> X, vc<int> Y, vc<int> W) {
vc<int> ind(M); for(ll i=0;i<M;++i) ind[i]=i;
sort(ind.begin(),ind.end(),[&](int a,int b){return Y[a]<Y[b];});
vc<vc<pair<int, int>>> f(N);
vc<vc<int>> rel(N), dp(N), dpn(N);
for(auto i: ind){
f[X[i]].emplace_back(Y[i], W[i]);
if(X[i]-1>=0) rel[X[i]-1].push_back(Y[i]),dp[X[i]-1].push_back(0),dpn[X[i]-1].push_back(0);
if(X[i]+1<N) rel[X[i]+1].push_back(Y[i]),dp[X[i]+1].push_back(0),dpn[X[i]+1].push_back(0);
}
for(ll i=0;i<N;++i){
if(i-2>=0){
for(ll j=0, prej=0, c=0, pp=0, mm=0;j<rel[i].size();++j){
while(pp<rel[i-2].size()&&rel[i-2][pp]<=rel[i][j])mm=max(mm, dp[i-2][pp]);
while(prej<f[i-1].size()&&f[i-1][prej].first<=rel[i][j])c+=f[i-1][prej++];
dp[i][j]=max(dp[i][j],mm+c);
}
for(ll j=(ll)rel[i].size()-1, pp=rel[i-2].size(), mm=0;j>=0;--j){
while(pp-1>=0&&rel[i-2][pp-1]>=rel[i][j])mm=max(mm, dpn[i-2][--pp]);
dp[i][j]=max(dp[i][j],mm+c);
}
}
if(i-1>=0){
for(ll j=0, prej=0, c=0, pf=0, mm=0;j<rel[i].size();++j){
while(pf<f[i-1].size()&&f[i-1][pf].first<=rel[i][j])mm=max(mm, dp[i-2][pp]);
while(prej<f[i-1].size()&&f[i-1][prej].first<=rel[i][j])c+=f[i-1][prej++];
dp[i][j]=max(dp[i][j],mm+c);
}
for(ll j=(ll)rel[i].size()-1, pp=rel[i-2].size(), mm=0;j>=0;--j){
while(pp-1>=0&&rel[i-2][pp-1]>=rel[i][j])mm=max(mm, dpn[i-2][--pp]);
dp[i][j]=max(dp[i][j],mm+c);
}
}
if(i+1<N){
for(ll j=0, nas=0, c=0;j<rel[i].size();++j){
while(nas<f[i+1].size()&&f[i+1][nas].first<=rel[i][j])c+=f[i+1][nas++];
dpn[i][j]=max(dpn[i][j],dp[i][j]+c);
}
}
for(ll j=0;j<rel[i].size();++j){
}
}
}
int main(){
}
컴파일 시 표준 에러 (stderr) 메시지
fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)': fish.cpp:21:50: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 21 | for(ll j=0, prej=0, c=0, pp=0, mm=0;j<rel[i].size();++j){ | ~^~~~~~~~~~~~~~ fish.cpp:22:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 22 | while(pp<rel[i-2].size()&&rel[i-2][pp]<=rel[i][j])mm=max(mm, dp[i-2][pp]); | ~~^~~~~~~~~~~~~~~~ fish.cpp:22:89: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 22 | while(pp<rel[i-2].size()&&rel[i-2][pp]<=rel[i][j])mm=max(mm, dp[i-2][pp]); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from fish.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: fish.cpp:22:89: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 22 | while(pp<rel[i-2].size()&&rel[i-2][pp]<=rel[i][j])mm=max(mm, dp[i-2][pp]); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from fish.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: fish.cpp:22:89: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 22 | while(pp<rel[i-2].size()&&rel[i-2][pp]<=rel[i][j])mm=max(mm, dp[i-2][pp]); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from fish.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3480 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3480:5: note: template argument deduction/substitution failed: fish.cpp:22:89: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 22 | while(pp<rel[i-2].size()&&rel[i-2][pp]<=rel[i][j])mm=max(mm, dp[i-2][pp]); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from fish.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3486:5: note: template argument deduction/substitution failed: fish.cpp:22:89: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 22 | while(pp<rel[i-2].size()&&rel[i-2][pp]<=rel[i][j])mm=max(mm, dp[i-2][pp]); | ^ fish.cpp:23:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 23 | while(prej<f[i-1].size()&&f[i-1][prej].first<=rel[i][j])c+=f[i-1][prej++]; | ~~~~^~~~~~~~~~~~~~ fish.cpp:23:74: error: no match for 'operator+=' (operand types are 'long long int' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'}) 23 | while(prej<f[i-1].size()&&f[i-1][prej].first<=rel[i][j])c+=f[i-1][prej++]; fish.cpp:24:43: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, long long int)' 24 | dp[i][j]=max(dp[i][j],mm+c); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from fish.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: fish.cpp:24:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 24 | dp[i][j]=max(dp[i][j],mm+c); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from fish.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: fish.cpp:24:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 24 | dp[i][j]=max(dp[i][j],mm+c); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from fish.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3480 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3480:5: note: template argument deduction/substitution failed: fish.cpp:24:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 24 | dp[i][j]=max(dp[i][j],mm+c); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from fish.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3486:5: note: template argument deduction/substitution failed: fish.cpp:24:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 24 | dp[i][j]=max(dp[i][j],mm+c); | ^ fish.cpp:27:83: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 27 | while(pp-1>=0&&rel[i-2][pp-1]>=rel[i][j])mm=max(mm, dpn[i-2][--pp]); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from fish.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: fish.cpp:27:83: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 27 | while(pp-1>=0&&rel[i-2][pp-1]>=rel[i][j])mm=max(mm, dpn[i-2][--pp]); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from fish.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: fish.cpp:27:83: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 27 | while(pp-1>=0&&rel[i-2][pp-1]>=rel[i][j])mm=max(mm, dpn[i-2][--pp]); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from fish.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3480 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3480:5: note: template argument deduction/substitution failed: fish.cpp:27:83: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 27 | while(pp-1>=0&&rel[i-2][pp-1]>=rel[i][j])mm=max(mm, dpn[i-2][--pp]); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from fish.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3486:5: note: template argument deduction/substitution failed: fish.cpp:27:83: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 27 | while(pp-1>=0&&rel[i-2][pp-1]>=rel[i][j])mm=max(mm, dpn[i-2][--pp]); | ^ fish.cpp:28:42: error: 'c' was not declared in this scope 28 | dp[i][j]=max(dp[i][j],mm+c); | ^ fish.cpp:32:50: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 32 | for(ll j=0, prej=0, c=0, pf=0, mm=0;j<rel[i].size();++j){ | ~^~~~~~~~~~~~~~ fish.cpp:33:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 33 | while(pf<f[i-1].size()&&f[i-1][pf].first<=rel[i][j])mm=max(mm, dp[i-2][pp]); | ~~^~~~~~~~~~~~~~ fish.cpp:33:88: error: 'pp' was not declared in this scope; did you mean 'pf'? 33 | while(pf<f[i-1].size()&&f[i-1][pf].first<=rel[i][j])mm=max(mm, dp[i-2][pp]); | ^~ | pf fish.cpp:34:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 34 | while(prej<f[i-1].size()&&f[i-1][prej].first<=rel[i][j])c+=f[i-1][prej++]; | ~~~~^~~~~~~~~~~~~~ fish.cpp:34:74: error: no match for 'operator+=' (operand types are 'long long int' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'}) 34 | while(prej<f[i-1].size()&&f[i-1][prej].first<=rel[i][j])c+=f[i-1][prej++]; fish.cpp:35:43: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, long long int)' 35 | dp[i][j]=max(dp[i][j],mm+c); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from fish.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: fish.cpp:35:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 35 | dp[i][j]=max(dp[i][j],mm+c); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from fish.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 300 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:300:5: note: template argument deduction/substitution failed: fish.cpp:35:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 35 | dp[i][j]=max(dp[i][j],mm+c); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from fish.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)' 3480 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3480:5: note: template argument deduction/substitution failed: fish.cpp:35:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 35 | dp[i][j]=max(dp[i][j],mm+c); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from fish.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)' 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/10/bits/stl_algo.h:3486:5: note: template argument deduction/substitution failed: fish.cpp:35:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 35 | dp[i][j]=max(dp[i][j],mm+c); | ^ fish.cpp:38:83: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 38 | while(pp-1>=0&&rel[i-2][pp-1]>=rel[i][j])mm=max(mm, dpn[i-2][--pp]); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from fish.cpp:1: /usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 254 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/10/bits/stl_algobase.h:254:5: note: template argument deduction/substitution failed: fish.cpp:38:83: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 38 | while(pp-1>=0&&rel[i-2][pp-1]>=rel[i][j])mm=max(mm, dpn[i-2][--pp]); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from /var/local/lib/isolate/246/box/pro