제출 #155539

#제출 시각아이디문제언어결과실행 시간메모리
155539Learner99Segway (COI19_segway)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define N 100006 int a[N][3]; #define ordered_set tree< pair < int , int > , null_type,less< pair < int , int > >, rb_tree_tag,tree_order_statistics_node_update> ordered_set s[405]; int acc[405] = {0}; int cur[N]; int ans[N]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i][0]>>a[i][1]>>a[i][2]; } int m; cin>>m; for(int i=0;i<m;i++) { int temp; cin>>temp; acc[temp] = 1; } set < pair < int , int > > rid; for(int i=1;i<=n;i++) { rid.insert({0, i}); } while(rid.size()!=0) { pair < int , int > t = *rid.begin(); rid.erase(t); int tme = t.first; int rider = t.second; if( acc[cur[rider]] == 0) { cur[rider]++; int x = 0; if(cur[rider]<= 100) { ans[rider]+=a[rider][0]; x = a[rider][0]; } else if(cur[rider]<=200) { ans[rider]+=a[rider][1]; x = a[rider][1]; } else { ans[rider]+=a[rider][2]; x = a[rider][2]; } if(cur[rider]<300) { rid.insert({tme+x, rider}); } s[cur[rider]].insert({tme+x, rider}); } else { int aage = s[cur[rider]].order_of_key({tme, 0}); aage%=20; if(aage==0) { cur[rider]++; int x = 0; if(cur[rider]<= 100) { ans[rider]+=a[rider][0]; x = a[rider][0]; } else if(cur[rider]<=200) { ans[rider]+=a[rider][1]; x = a[rider][1]; } else { ans[rider]+=a[rider][2]; x = a[rider][2]; } if(cur[rider]<300) { rid.insert({tme+x, rider}); } s[cur[rider]].insert({tme+x, rider}); } else { int y = 1; int p = cur[rider]; for(int i=p+1;i<=min(300ll, p+aage);i++) { ans[rider]++; cur[rider]++; s[i].insert({tme+y, rider}); y++; } if(cur[rider] < 300) rid.insert({tme+aage, rider}); } } } for(int i=1;i<=n;i++) { cout<<ans[i]<<"\n"; } cout<<endl; return 0; }

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

segway.cpp: In function 'int32_t main()':
segway.cpp:117:51: error: no matching function for call to 'min(long long int, int)'
                 for(int i=p+1;i<=min(300ll, p+aage);i++)
                                                   ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from segway.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
segway.cpp:117:51: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
                 for(int i=p+1;i<=min(300ll, p+aage);i++)
                                                   ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from segway.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
segway.cpp:117:51: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
                 for(int i=p+1;i<=min(300ll, p+aage);i++)
                                                   ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from segway.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
segway.cpp:117:51: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
                 for(int i=p+1;i<=min(300ll, p+aage);i++)
                                                   ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from segway.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
segway.cpp:117:51: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
                 for(int i=p+1;i<=min(300ll, p+aage);i++)
                                                   ^