# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
362822 | 2021-02-04T13:06:19 Z | Sparky_09 | Calvinball championship (CEOI15_teams) | C++17 | 컴파일 오류 |
0 ms | 0 KB |
#include "bits/stdc++.h" using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define trav(a, x) for(auto& a : x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<ll, ll> pii; typedef vector<ll> vi; typedef vector<pii> vpi; void usaco(string s){ freopen((s+".in").c_str(), "r", stdin); freopen((s+".out").c_str(), "w", stdout); } const ll mod = 1e6 + 7; const int N = 1e4 + 10; int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); #ifdef LOCAL_DEFINE freopen("input.txt", "r", stdin); #endif int n, a[N], dp[2][N], mx[N]; cin >> n; for(int i = 1; i <= n; i++){ cin > a[i]; mx[i] = max(mx[i-1], a[i]); } for(int i = 0; i <= n; i++){ dp[0][i] = 1; } int ans = a[n], t = 1; for(int i = 1; i < n; i++){ t = (i%2?1:0); for(int j = 1; j <= n; j++){ dp[t][j] = (dp[t^1][j+1] + 1LL * dp[t^1][j] * j % mod)%mod; } ans = (ans + 1LL * dp[t][mx[n-i-1]] * (a[n-i]-1)%mod)%mod; } cout << ans%mod; }
Compilation message
teams.cpp: In function 'int main()': teams.cpp:29:9: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 29 | cin > a[i]; | ~~~ ^ ~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} teams.cpp:29:9: note: candidate: 'operator>(int, int)' <built-in> 29 | cin > a[i]; | ~~~~^~~~~~ teams.cpp:29:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/9/regex:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110, from teams.cpp:1: /usr/include/c++/9/bits/regex.h:1081:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)' 1081 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/9/bits/regex.h:1081:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/regex:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110, from teams.cpp:1: /usr/include/c++/9/bits/regex.h:1136:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)' 1136 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/regex.h:1136:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/regex:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110, from teams.cpp:1: /usr/include/c++/9/bits/regex.h:1210:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1210 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/regex.h:1210:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/regex:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110, from teams.cpp:1: /usr/include/c++/9/bits/regex.h:1284:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)' 1284 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/regex.h:1284:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/regex:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110, from teams.cpp:1: /usr/include/c++/9/bits/regex.h:1358:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1358 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/regex.h:1358:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/regex:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110, from teams.cpp:1: /usr/include/c++/9/bits/regex.h:1434:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)' 1434 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/regex.h:1434:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/regex:62, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110, from teams.cpp:1: /usr/include/c++/9/bits/regex.h:1512:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1512 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/regex.h:1512:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/bits/stl_algobase.h:64, from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from teams.cpp:1: /usr/include/c++/9/bits/stl_pair.h:467:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)' 467 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/9/bits/stl_pair.h:467:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/bits/stl_algobase.h:67, from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from teams.cpp:1: /usr/include/c++/9/bits/stl_iterator.h:343:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)' 343 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/9/bits/stl_iterator.h:343:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/bits/stl_algobase.h:67, from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from teams.cpp:1: /usr/include/c++/9/bits/stl_iterator.h:381:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)' 381 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/9/bits/stl_iterator.h:381:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/bits/stl_algobase.h:67, from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from teams.cpp:1: /usr/include/c++/9/bits/stl_iterator.h:1187:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)' 1187 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/9/bits/stl_iterator.h:1187:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/bits/stl_algobase.h:67, from /usr/include/c++/9/bits/specfun.h:45, from /usr/include/c++/9/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41, from teams.cpp:1: /usr/include/c++/9/bits/stl_iterator.h:1193:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)' 1193 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/9/bits/stl_iterator.h:1193:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/bits/basic_string.h:48, from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from teams.cpp:1: /usr/include/c++/9/string_view:527:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::basic_string_view<_CharT, _Traits>, std::basic_string_view<_CharT, _Traits>)' 527 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/9/string_view:527:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/bits/basic_string.h:48, from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from teams.cpp:1: /usr/include/c++/9/string_view:533:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::basic_string_view<_CharT, _Traits>, std::__detail::__idt<std::basic_string_view<_CharT, _Traits> >)' 533 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/9/string_view:533:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/bits/basic_string.h:48, from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from teams.cpp:1: /usr/include/c++/9/string_view:539:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::__detail::__idt<std::basic_string_view<_CharT, _Traits> >, std::basic_string_view<_CharT, _Traits>)' 539 | operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/9/string_view:539:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from teams.cpp:1: /usr/include/c++/9/bits/basic_string.h:6264:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 6264 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6264:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from teams.cpp:1: /usr/include/c++/9/bits/basic_string.h:6277:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 6277 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6277:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/string:55, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/istream:38, from /usr/include/c++/9/sstream:38, from /usr/include/c++/9/complex:45, from /usr/include/c++/9/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54, from teams.cpp:1: /usr/include/c++/9/bits/basic_string.h:6289:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 6289 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.h:6289:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/tuple:39, from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from teams.cpp:1: /usr/include/c++/9/array:270:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> bool std::operator>(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)' 270 | operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) | ^~~~~~~~ /usr/include/c++/9/array:270:5: note: template argument deduction/substitution failed: teams.cpp:29:14: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::array<_Tp, _Nm>' 29 | cin > a[i]; | ^ In file included from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from teams.cpp:1: /usr/include/c++/9/tuple:1451:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const std::tuple<_Tps ...>&, const std::tuple<_Elements ...>&)' 1451 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/9/tuple:1451:5: note: template argument deduction/substitution failed: teams.cpp: