submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s498054765 | p03731 | C++ | #include <iostream>
#include <map>
#include <vector>
#include <algorithm>
int main(){
int n, shower;
std::cin >> n >> shower;
int ans = 0;
std::vector<int> t(n);
std::cin >> t.at(0);
for(int i = 1; i < n; ++i){
std::cin >> t.at(i);
if(t.at(i) - t.at(i - 1) < shower){
ans += t.at(i) - t.at(i - 1) < t;
}else{
ans += t;
}
}
std::cout << ans << std::endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:42: error: no match for 'operator<' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>')
16 | ans += t.at(i) - t.at(i - 1) < t;
| ~~~~~~~~~~~~~~~~~~~~~ ^ ~
| | |
| | std::vector<int>
| __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: 'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
/usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3901 | operator<(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const _CharT*' and 'int'
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2600 | operator<(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const std::tuple<_UTypes ...>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:2:
/usr/include/c++/14/bits/stl_map.h:1550:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
1550 | operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1550:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const std::map<_Key, _Tp, _Compare, _Allocator>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
16 | ans += t.at(i) - t.at(i - 1) < t;
| ^
In file included from /usr/include/c++/14/map:64:
/usr/include/c++/14/bits/stl_multimap.h:1172:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const multimap<_Key, _Tp, _Compare, _Allocator>&, const multimap<_Key, _Tp, _Compare, _Allocator>&)'
1172 | operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multimap.h:1172:5: note: template argument deduction/substitution failed:
a.cc:16:44: note: mismatched types 'const std |
s031687877 | p03731 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll)1e15;
int main()
{
ll N, T;
cin >> N >> T;
ll sum = T;
ll prev = 0;
REP(i, N)
{
ll t;
cin >> t;
sum += std::min(T, t - preb);
preb = t;
}
cout << sum << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:32: error: 'preb' was not declared in this scope; did you mean 'prev'?
26 | sum += std::min(T, t - preb);
| ^~~~
| prev
|
s089414602 | p03731 | C++ | #include<bits/stdc++.h>
using namespace std;
int a[114];
#define int long long
int main() {
int n,t;
cin >> n;
for (int i = 0; i < n; i++) { cin >> a[i]; }
int sum = 0;
for (int i = 0; i < n - 1; i++) { sum += min(a[i + 1] - a[i], t); }
cout << sum << endl;
} | cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:10:53: error: no matching function for call to 'min(int, long long int&)'
10 | for (int i = 0; i < n - 1; i++) { sum += min(a[i + 1] - a[i], t); }
| ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:10:53: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
10 | for (int i = 0; i < n - 1; i++) { sum += min(a[i + 1] - a[i], t); }
| ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:10:53: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
10 | for (int i = 0; i < n - 1; i++) { sum += min(a[i + 1] - a[i], t); }
| ~~~^~~~~~~~~~~~~~~~~~~~
|
s280241839 | p03731 | C++ | #include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<set>
using namespace std;
int before ,end;
int n, t;
int now;
int ans;
int main(){
scanf("%d %d", &n, &t);
scanf("%d",&end);
for(int i = 2 ; i <= n ; i++){
before = end;
scanf("%d", &end);
if(end - before > t)ans += t;
else ans += end - before;
}
ans += t;
printf("%d",ans);
} | a.cc: In function 'int main()':
a.cc:14:21: error: reference to 'end' is ambiguous
14 | scanf("%d",&end);
| ^~~
In file included from /usr/include/c++/14/string:53,
from a.cc:5:
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
from /usr/include/c++/14/bits/stl_algo.h:59,
from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:8:13: note: 'int end'
8 | int before ,end;
| ^~~
a.cc:16:26: error: reference to 'end' is ambiguous
16 | before = end;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:8:13: note: 'int end'
8 | int before ,end;
| ^~~
a.cc:17:30: error: reference to 'end' is ambiguous
17 | scanf("%d", &end);
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:8:13: note: 'int end'
8 | int before ,end;
| ^~~
a.cc:19:20: error: reference to 'end' is ambiguous
19 | if(end - before > t)ans += t;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:8:13: note: 'int end'
8 | int before ,end;
| ^~~
a.cc:20:29: error: reference to 'end' is ambiguous
20 | else ans += end - before;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:8:13: note: 'int end'
8 | int before ,end;
| ^~~
|
s990683465 | p03731 | C++ | #include<iostream>
using namespace std;
int main(){
int n,T,ans=0;cin>>n>>T;
int t[n];
for(int i=0;i<n;i++)cin>>t[i];
for(int i=0;i<n;i++){
if(t[i]-t[i-1]<T)ans+=t[i]-[i-1];
else ans+=T;
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:9:34: error: expected ',' before '-' token
9 | if(t[i]-t[i-1]<T)ans+=t[i]-[i-1];
| ^
| ,
a.cc:9:34: error: expected identifier before '-' token
a.cc: In lambda function:
a.cc:9:37: error: expected '{' before ';' token
9 | if(t[i]-t[i-1]<T)ans+=t[i]-[i-1];
| ^
a.cc: In function 'int main()':
a.cc:9:31: error: no match for 'operator-' (operand types are 'int' and 'main()::<lambda()>')
9 | if(t[i]-t[i-1]<T)ans+=t[i]-[i-1];
| ~~~~^~~~~~
| | |
| | main()::<lambda()>
| int
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:9:37: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
9 | if(t[i]-t[i-1]<T)ans+=t[i]-[i-1];
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:9:37: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
9 | if(t[i]-t[i-1]<T)ans+=t[i]-[i-1];
| ^
|
s987877945 | p03731 | C++ | #include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
using namespace std;
int main(){
int n,t;
cin >> n >> t;
long long total=0;
int now=0;
vector<long long> tl(n);
for(int i=0;i<n;i++){
cin >> tl[i];
}
for(int i=0;i<n-1;i++){
now = tl[i+1]-tl[i];
total+=min(t,now);
}
total+=t;
cout << total << endl;
} | a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
9 | cin >> n >> t;
| ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
5 | #include <deque>
+++ |+#include <iostream>
6 | using namespace std;
a.cc:21:5: error: 'cout' was not declared in this scope
21 | cout << total << endl;
| ^~~~
a.cc:21:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:22: error: 'endl' was not declared in this scope
21 | cout << total << endl;
| ^~~~
a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
5 | #include <deque>
+++ |+#include <ostream>
6 | using namespace std;
|
s424986033 | p03731 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long n,t[200000];
cin >> n >> t;
long long a=n*t;
for(int i=0;i!=n;i++){
cin >> t[i];
if(t[i]<t){
a-=t-t[i];
}
}
cout << a << endl;
}
| a.cc: In function 'int main()':
a.cc:8:12: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'long long int [200000]')
8 | cin >> n >> t;
| ~~~~~~~~ ^~ ~
| | |
| | long long int [200000]
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:15: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'long long int*'
8 | cin >> n >> t;
| ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:15: error: invalid conversion from 'long long int*' to 'short int' [-fpermissive]
8 | cin >> n >> t;
| ^
| |
| long long int*
a.cc:8:15: error: cannot bind rvalue '(short int)((long long int*)(& t))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:15: error: invalid conversion from 'long long int*' to 'short unsigned int' [-fpermissive]
8 | cin >> n >> t;
| ^
| |
| long long int*
a.cc:8:15: error: cannot bind rvalue '(short unsigned int)((long long int*)(& t))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:15: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
8 | cin >> n >> t;
| ^
| |
| long long int*
a.cc:8:15: error: cannot bind rvalue '(int)((long long int*)(& t))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:15: error: invalid conversion from 'long long int*' to 'unsigned int' [-fpermissive]
8 | cin >> n >> t;
| ^
| |
| long long int*
a.cc:8:15: error: cannot bind rvalue '(unsigned int)((long long int*)(& t))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:15: error: invalid conversion from 'long long int*' to 'long int' [-fpermissive]
8 | cin >> n >> t;
| ^
| |
| long long int*
a.cc:8:15: error: cannot bind rvalue '(long int)((long long int*)(& t))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:15: error: invalid conversion from 'long long int*' to 'long unsigned int' [-fpermissive]
8 | cin >> n >> t;
| ^
| |
| long long int*
a.cc:8:15: error: cannot bind rvalue '(long unsigned int)((long long int*)(& t))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:15: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
8 | cin >> n >> t;
| ^
| |
| long long int*
a.cc:8:15: error: cannot bind rvalue '(long long int)((long long int*)(& t))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:15: error: invalid conversion from 'long long int*' to 'long long unsigned int' [-fpermissive]
8 | cin >> n >> t;
| ^
| |
| long long int*
a.cc:8:15: error: cannot bind rvalue '(long long unsigned int)((long long int*)(& t))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:8:15: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
8 | cin >> n >> t;
| ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'long long int [200000]' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'long long int [200000]' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'long long int [200000]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'long long int [200000]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char |
s464766849 | p03731 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,T,t[200000],ans=0;
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>t[i];
}
for(int i=0;i<n-1;i++){
if(t[i]+T<=t[i+1]){
ans+=T;
}else{
ans+=(t[i+1]-t[i]);
}
}
ans+=T;
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:6:9: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int [200000]')
6 | cin>>n>>t;
| ~~~~~~^~~
| | |
| | int [200000]
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*'
6 | cin>>n>>t;
| ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int*' to 'short int' [-fpermissive]
6 | cin>>n>>t;
| ^
| |
| int*
a.cc:6:11: error: cannot bind rvalue '(short int)((int*)(& t))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive]
6 | cin>>n>>t;
| ^
| |
| int*
a.cc:6:11: error: cannot bind rvalue '(short unsigned int)((int*)(& t))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int*' to 'int' [-fpermissive]
6 | cin>>n>>t;
| ^
| |
| int*
a.cc:6:11: error: cannot bind rvalue '(int)((int*)(& t))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive]
6 | cin>>n>>t;
| ^
| |
| int*
a.cc:6:11: error: cannot bind rvalue '(unsigned int)((int*)(& t))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int*' to 'long int' [-fpermissive]
6 | cin>>n>>t;
| ^
| |
| int*
a.cc:6:11: error: cannot bind rvalue '(long int)((int*)(& t))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive]
6 | cin>>n>>t;
| ^
| |
| int*
a.cc:6:11: error: cannot bind rvalue '(long unsigned int)((int*)(& t))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int*' to 'long long int' [-fpermissive]
6 | cin>>n>>t;
| ^
| |
| int*
a.cc:6:11: error: cannot bind rvalue '(long long int)((int*)(& t))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive]
6 | cin>>n>>t;
| ^
| |
| int*
a.cc:6:11: error: cannot bind rvalue '(long long unsigned int)((int*)(& t))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:11: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
6 | cin>>n>>t;
| ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'int [200000]' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'int [200000]' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'int [200000]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'int [200000]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'int [200000]' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~ |
s213303509 | p03731 | C++ | #include bits<stdc++.h>
using namespace std;
int main(){
int n,T,t[200000],ans=0;
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>t[i];
}
for(int i=0;i<n-1;i++){
if(t[i]+T<=t[i+1]){
ans+=T;
}else{
ans+=(t[i+1]-t[i]);
}
}
ans+=T;
cout<<ans<<endl;
} | a.cc:1:10: error: #include expects "FILENAME" or <FILENAME>
1 | #include bits<stdc++.h>
| ^~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin>>n>>t;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #include bits<stdc++.h>
a.cc:18:3: error: 'cout' was not declared in this scope
18 | cout<<ans<<endl;
| ^~~~
a.cc:18:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:14: error: 'endl' was not declared in this scope
18 | cout<<ans<<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #include bits<stdc++.h>
|
s542402091 | p03731 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void){
// Your code here!
int n,t;
cin>>n>>t;
int time[n];
for(int i=0;i<n;i++){
cin>>time[i];
}
long int sum=0;
for(int i=0;i<n-1;i++){
if(time[i]+t > time[i+1]){
sum+=time[i+1]-t[i];
}else{
sum+=t;
}
}
cout<<sum+t<<endl;
}
| a.cc: In function 'int main()':
a.cc:16:29: error: invalid types 'int[int]' for array subscript
16 | sum+=time[i+1]-t[i];
| ^
|
s943666938 | p03731 | Java | import java.util.Scanner;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count = sc.nextInt();
int time = sc.nextInt();
int[] history = new int[count];
for (int i = 0; i < count; i++) {
history[i] = sc.nextInt();
}
long total = 0;
long beforeTime = 0;
long afterTime = 0;
long diffTime = 0;
for (int i = 1; i < history.length; i++) {
beforeTime = history[i - 1];
afterTime = history[i];
diffTime = (afterTime - beforeTime);
if (diffTime < time) {
total += diffTime;
} else {
total += time;
}
}
total += time;
System.out.println(total);
} | Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
^
(use --enable-preview to enable unnamed classes)
1 error
|
s347351653 | p03731 | C++ | // C++bool練習用.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
int main()
{
int i, j, k, l, m, N,cnt, T;
long long int sum;
long long int t[200000];
cin >> N;
cin >> T;
for (i = 0; i < N; i++) {
cin >> t[i];
}
sum = T;
for (i = 0; i < N-1; i++) {
if (t[i] + T <= t[i + 1]) {
sum += T;
}
else {
sum += t[i + 1] - t[i];
}
}
cout << sum << endl;
return 0;
}
| a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s268240332 | p03731 | C++ | #include<iostream>
using namespace std;
int t[200000];
int main(){
int n=0;
__int64 ans=0;
int T=0;
int i=0;
cin>>n>>T;
for(i=0;i<n;i++){
cin>>t[i];
}
ans=T;
for(i=1;i<n;i++){
if(T>=t[i]){
ans=t[i]+T;
}else{
ans=ans+T;
}
}
cout<<ans;
} | a.cc: In function 'int main()':
a.cc:6:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
6 | __int64 ans=0;
| ^~~~~~~
| __int64_t
a.cc:13:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
13 | ans=T;
| ^~~
| abs
|
s910317732 | p03731 | C++ | #include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<queue>
#include<stack>
#include<map>
using namespace std;
typedef long long ll;
typedef double db;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int>P;
int main(){
ll n, t, sum, tmp;
vector<int> array;
scanf("%d %lld", &n, &t);
for(int i = 0; i < n; i++){
scanf("%lld", &tmp);
if(tmp > t){
array.push_back(t);
} else {
array.push_back(tmp);
}
}
sum = accumulate(array.begin(), array.end(), 0) + t;
printf("%lld\n", sum);
return 0;
}
| a.cc: In function 'int main()':
a.cc:30:9: error: 'accumulate' was not declared in this scope
30 | sum = accumulate(array.begin(), array.end(), 0) + t;
| ^~~~~~~~~~
|
s050964224 | p03731 | C | #include <stdio.h>
#include <string.h>
void main(){
int n;
int t;
scanf("%d %d",&n ,&t);
int i;
int[] tn;
for(i =0; i <n; i++){
scanf("%d", &tn[i]);
}
int x;
for(i=0; i<n; i++){
x += t;
if(tn[i] < t){
x += t-tn[i];
}
}
printf("%d",x);
} | main.c: In function 'main':
main.c:10:12: error: expected identifier or '(' before '[' token
10 | int[] tn;
| ^
main.c:12:22: error: 'tn' undeclared (first use in this function); did you mean 't'?
12 | scanf("%d", &tn[i]);
| ^~
| t
main.c:12:22: note: each undeclared identifier is reported only once for each function it appears in
|
s466323939 | p03731 | C | #include <stdio.h>
#include <string.h>
int main(void){
int n;
int t;
scanf("%d %d",&n &t);
int i;
int tn[100000000];
for(i =0; i <n; i++){
scanf("%d", &tn[i]);
}
int x;
for(i=0; i<n; i++){
x += t;
if(tn[i] < t){
x += t-tn[i];
}
}
printf("%d",x);
return 0;
} | main.c: In function 'main':
main.c:7:26: error: invalid operands to binary & (have 'int *' and 'int')
7 | scanf("%d %d",&n &t);
| ~~ ^
| |
| int *
|
s723109941 | p03731 | C++ | void main(){
int n;
int t;
scanf("%d %d",&n &t);
int i;
int tn[];
for(i =0; i <n; i++){
scanf("%d", &tn[i]);
}
int x;
for(i=0; i<n; i++){
x += t;
if(tn[i] < t){
x += t-tn[i];
}
}
printf("%d",x);
} | a.cc:1:1: error: '::main' must return 'int'
1 | void main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:4:18: error: invalid operands of types 'int*' and 'int' to binary 'operator&'
4 | scanf("%d %d",&n &t);
| ~~ ^~
| | |
| | int
| int*
a.cc:4:1: error: 'scanf' was not declared in this scope
4 | scanf("%d %d",&n &t);
| ^~~~~
a.cc:7:5: error: storage size of 'tn' isn't known
7 | int tn[];
| ^~
a.cc:21:1: error: 'printf' was not declared in this scope
21 | printf("%d",x);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | void main(){
|
s009595017 | p03731 | C++ | #include <iostream>
#define int long long
using namespace std;
int x[200001] = {};
unsigned main() {
int N, T;
cin >> N >> T;
for (int i = 0; i < N; i++) {
cin >> x[i];
}
int num = 0, sum = 0;
for (int i = 0; i < N; i++) {
if (x[i] < num) {
sum -= (num - x[i]);
sum += T;
num = x[i] + T;
}
else {
num = x[i] + T;
sum += T;
}
}
cout << sum << endl;
} | cc1plus: error: '::main' must return 'int'
|
s048601612 | p03731 | C++ | #include<stdio.h>
int main()
{
int N,T;
int t[200000];
int x;
scanf("%d %d",&N,&T);
for (x=0;x<N;x++)
scan("%d",&t[x]);
int sum;
for (x=0;x<N;x++)
{
if(t[x]<=T)
sum+=t[x];
else
sum+=T;
}
printf("%d",sum);
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:1: error: 'scan' was not declared in this scope; did you mean 'scanf'?
9 | scan("%d",&t[x]);
| ^~~~
| scanf
|
s212223737 | p03731 | Java | import java.util.*;
public class Main {
public static void main(String []args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int t = sc.nextInt();
int[] frags = new int[n];
int i = 0;
while(sc.hasNext()) {
frags[i++] = sc.nextInt();
}
Main soln = new Main();
System.out.println(soln.jdg(t, frags));
}
private long jdg(int t, int[] frags) {
long res = (long)t;
if(frags.length==1) return res;
int dlt = 0;
for(int i=0; i<dlt.length; i++) {
dlt = frags[i+1]-frags[i];
res += (long)((dlt<t)? dlt:t);
}
return res;
}
} | Main.java:21: error: int cannot be dereferenced
for(int i=0; i<dlt.length; i++) {
^
1 error
|
s947740398 | p03731 | C++ | #include <iostream>
using namespace std;
int main(){
int N,T;
cin >> N >> T;
int t[N];
scanf("%d",t);
long long now=0,ans=0;
for(int i=0;i<N;i++){
if(t[i+1]>t[i]+T){
ans-=(t[i+1]-t[i]);
ans+=T;
}
}
ans+=t[i]+T;
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:15:10: error: 'i' was not declared in this scope
15 | ans+=t[i]+T;
| ^
|
s273383142 | p03731 | C++ | #include <iostream>
using namespace std;
int int main(){
int N,T;
cin >> N >> T;
int t[N];
scanf("%d",t);
long long now=0,ans=0;
for(int i=0;i<N;i++){
if(t[i]>now){
ans-=t[i]-now;
}
if(t[i]+T>now){
now=t[i]+T;
}
}
ans+=now;
cout << ans << endl;
return 0;
}
| a.cc:3:1: error: two or more data types in declaration of 'main'
3 | int int main(){
| ^~~
|
s650710343 | p03731 | C | #include <iostream>
using namespace std;
int int main(){
int N,T;
cin >> N >> T;
int t[N];
scanf("%d",t);
long long now=0,ans=0;
for(int i=0;i<N;i++){
if(t[i]>now){
ans-=t[i]-now;
}
if(t[i]+T>now){
now=t[i]+T;
}
}
ans+=now;
cout << ans << endl;
return 0;
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s596453290 | p03731 | Java | import java.util.Scanner;
public class Main {
public static void main(String args[]){
Scanner cin = new Scanner(System.in);
int N = cin.nextInt();
long T = cin.nextLong();
long before = cin.nextLong();
if(N>1){
long tmp = cin.nextLong();
}
long sum =0L;
for(int i=0;i<N-1;i++){
if(tmp-before<T){
sum += T-(tmp-before);
}
if(i<N-2){
before = tmp;
tmp = cin.nextLong();
}
}
System.out.println(N*T-sum);
}
}
| Main.java:19: error: cannot find symbol
if(tmp-before<T){
^
symbol: variable tmp
location: class Main
Main.java:20: error: cannot find symbol
sum += T-(tmp-before);
^
symbol: variable tmp
location: class Main
Main.java:23: error: cannot find symbol
before = tmp;
^
symbol: variable tmp
location: class Main
Main.java:24: error: cannot find symbol
tmp = cin.nextLong();
^
symbol: variable tmp
location: class Main
4 errors
|
s308458629 | p03731 | Java | import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int t = scan.nextInt();
int s = scan.nextInt();
int sum = 0;
for(int i = 1 ; i < n ; < i++){
int time = scan.nextInt();
if(time - s >= t){
sum += t;
} else {
sum += time - s;
}
s = time;
}
System.out.println(sum);
}
} | Main.java:13: error: > or ',' expected
for(int i = 1 ; i < n ; < i++){
^
Main.java:13: error: illegal start of expression
for(int i = 1 ; i < n ; < i++){
^
2 errors
|
s725101212 | p03731 | Java | import java.util.Scanner;
public class Main{
pulic static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = Integer.ParseInt(scan.read());
int t = Integer.ParseInt(scan.read());
int s = Integer.ParseInt(scan.next());;
int sum = 0;
for(int i = 1 ; i < n ; < i++){
int time = Integer.ParseInt(scan.next());
if(time - s >= t){
sum += t;
} else {
sum += time - s;
}
s = time;
}
System.out.println(sum);
}
} | Main.java:4: error: <identifier> expected
pulic static void main(String[] args){
^
Main.java:13: error: > or ',' expected
for(int i = 1 ; i < n ; < i++){
^
Main.java:13: error: illegal start of expression
for(int i = 1 ; i < n ; < i++){
^
3 errors
|
s817015334 | p03731 | C++ | #include <iostream>
#include <ios>
using namespace std;
// ABC060C Sentou
int main() {
ios.sync_with_stdio(false);
int N, T, t;
cin >> N >> T;
int total = T;
int prev_t = 0;
for (int i = 0; i < N; ++i){
cin >> t;
if (prev_t + T < t){
total += T;
}else {
total += t - prev_t;
}
prev_t = t;
}
cout << total << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:8: error: expected unqualified-id before '.' token
8 | ios.sync_with_stdio(false);
| ^
|
s489539698 | p03731 | C | #include <stdio.h>
int main(){
long long int n,t,tmpa,tmpb,i,ret=0;
scanf("%lld%lld",&n,&t);
for(i=1;i<n;i++){
scanf("%lld ",&tmpa);
if(i!=1){
ret += (tmpa-tmpb>t)?t:(tmpa-tmpb);
}
tmpb = tmpa;
//printf("%d\n",ret); }
scanf("%lld",&tmpa);
ret += (tmpa-tmpb>t)?t:(tmpa-tmpb);
printf("%lld\n",ret+t);
return 0;
} | main.c: In function 'main':
main.c:17:1: error: expected declaration or statement at end of input
17 | }
| ^
|
s739170465 | p03731 | C | #include <stdio.h>
int main()
{
int a,b,i;
int count=0;
scanf("%d %d",&a,&b);
int c[a];
for(i=0;i<a;i++){
scanf("%d",&c[i]);
}
for(i=0;i<a;i++){
count+=b;
if (i+1 == a) {
count += b;
} else if((c[i+1]-c[i])<b) {
count += c[i+1]-c[i];
} else {
count += b;
}
}
printf("%d\n",count);
| main.c: In function 'main':
main.c:25:1: error: expected declaration or statement at end of input
25 | printf("%d\n",count);
| ^~~~~~
|
s918706800 | p03731 | C | #include <stdio.h>
int main()
{
int a,b,i;
int count=0;
scanf("%d %d",&a,&b);
int c[a];
for(i=0;i<a;i++){
scanf("%d",&c[i]);
}
for(i=0;i<a;i++){
count+=b;
if (i+1 == a) {
count += b
} else if((c[i+1]-c[i])<b) {
count += c[i+1]-c[i]
} else {
count += b
}
}
printf("%d\n",count);
} | main.c: In function 'main':
main.c:17:11: error: expected ';' before '}' token
17 | count += b
| ^
| ;
18 | } else if((c[i+1]-c[i])<b) {
| ~
main.c:19:21: error: expected ';' before '}' token
19 | count += c[i+1]-c[i]
| ^
| ;
20 | } else {
| ~
main.c:21:11: error: expected ';' before '}' token
21 | count += b
| ^
| ;
22 | }
| ~
|
s755739829 | p03731 | C++ | #include<iostream>
using namespace std;
int N,T;
int a[2000000];
int main(){
cin>>N>>T;
int sum=0;
for (int i=0;i<N;i++){
cin>>a[i];
if(i==0)sum=T;
else{
if(a[i]-a[i-1]<=T){
int len=T-(t[i]-t[i-1]);
sum=+sum-len+T;
}
else{
sum=sum+T;
}
}
}
cout<<sum<<endl;
} | a.cc: In function 'int main()':
a.cc:13:44: error: 't' was not declared in this scope
13 | int len=T-(t[i]-t[i-1]);
| ^
|
s811593751 | p03731 | C++ | #include <iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional> //sort(A,A.end(),greater<int>());降順ソート
#include <queue>
#include <stack>
#include <vector>
#define INF 10 << 10
typedef long long int llint;
vector<llint> time;
int main() {
llint n, t;
cin >> n >> t;
for (llint i = 0; i < n; ++i) {
llint temp;
cin >> temp;
time.push_back(temp);
}
llint x = 0;
llint now = time[0];
for (llint i = 1; i < n; ++i) {
if (now + t >= time[i]) {
x += time[i] - now;
}
else {
x += t;
}
now = time[i];
}
cout << x + t << endl;
return 0;
}
| a.cc:17:15: error: 'std::vector<long long int> time' redeclared as different kind of entity
17 | vector<llint> time;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:25:22: error: request for member 'push_back' in 'time', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
25 | time.push_back(temp);
| ^~~~~~~~~
a.cc:29:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
29 | llint now = time[0];
| ^
a.cc:29:27: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'llint' {aka 'long long int'} [-fpermissive]
29 | llint now = time[0];
| ^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:31:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | if (now + t >= time[i]) {
| ^
a.cc:31:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
31 | if (now + t >= time[i]) {
| ~~~~~~~~^~~~~~~~~~
a.cc:32:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | x += time[i] - now;
| ^
a.cc:32:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | x += time[i] - now;
| ~~~~~~~~^~~~~
a.cc:32:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | x += time[i] - now;
| ~~^~~~~~~~~~~~~~~~
a.cc:32:27: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'llint' {aka 'long long int'} [-fpermissive]
32 | x += time[i] - now;
| ~~^~~~~~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:37:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
37 | now = time[i];
| ^
a.cc:37:29: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'llint' {aka 'long long int'} [-fpermissive]
37 | now = time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s905258002 | p03731 | C++ | #include<iostream>
using namespace std;
int main(){
int n,t,sum=0,fin,ans=0,big=0;
long int t2;
cin>>n>>t;
fin=t
for(int i=0;i<n;i++){
cin>>t2;
if(t2<=fin){
fin=t2+t;
}
else{
ans=ans+fin-big;
big=t2;
fin=t+t2;
}
}
ans=ans+fin-big;
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:6: error: expected ';' before 'for'
9 | fin=t
| ^
| ;
10 | for(int i=0;i<n;i++){
| ~~~
a.cc:10:13: error: 'i' was not declared in this scope
10 | for(int i=0;i<n;i++){
| ^
|
s305282692 | p03731 | C++ | #include<iostream>
using namespace std;
#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true " : cout<<"false ";
#define END cout<<"\n";
#endif
int main(){
int n,t,sum=0,fin,ans=0,big=0;
long int t2;
cin>>n>>t;
fin=t
for(int i=0;i<n;i++){
cin>>t2;
if(t2<=fin){
fin=t2+t;
}
else{
ans=ans+fin-big;
big=t2;
fin=t+t2;
}
}
ans=ans+fin-big;
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:6: error: expected ';' before 'for'
13 | fin=t
| ^
| ;
14 | for(int i=0;i<n;i++){
| ~~~
a.cc:14:13: error: 'i' was not declared in this scope
14 | for(int i=0;i<n;i++){
| ^
|
s893347274 | p03731 | C++ | #include <iostream>
using namespace std;
int main(){
long long N,T;
cin >> N >> T;
long long t[N+1]; // how to initialize this kind of variable-sized object?
for(int i=0;i<N+1;i++) t[i]=LONG_MAX;
for(int i=0;i<N;i++) cin >> t[i];
long long ans = 0;
int i=0;
long long prev = 0;
while(i < N){
prev = i;
while(t[i+1] < t[i]+ T){
i += 1;
}
ans += t[i] + T - t[prev];
i += 1;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:33: error: 'LONG_MAX' was not declared in this scope
9 | for(int i=0;i<N+1;i++) t[i]=LONG_MAX;
| ^~~~~~~~
a.cc:2:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 |
|
s216920079 | p03731 | C++ | #include<bits/stdc++.h>
using namespace std;
int n;
long long t,ans=0;
int main()
{
cin>>n>>t;
cin>>p;
if(n==1){
cout<<t<<endl;return 0;}
for(int i=2;i<=n;i++)
{
cin>>q;
ans+=min(t,q-p);
p=q;
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:10:10: error: 'p' was not declared in this scope
10 | cin>>p;
| ^
a.cc:17:10: error: 'q' was not declared in this scope
17 | cin>>q;
| ^
|
s606297831 | p03731 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;A
int main(){
long long int n,t;
vector<long long int> v;
long long int total=0;
int now=0;
cin>>n>>t;
for(int i=0;i<n;i++){
long long int tmp;
cin>>tmp;
v.push_back(tmp);
}
now=v[0];
for(int i=1;i<n;i++){
total+=min(t,v[i]-v[i-1]);
}
total+=t;
cout<<total<<endl;
return 0;
} | a.cc:5:21: error: 'A' does not name a type
5 | using namespace std;A
| ^
|
s893117415 | p03731 | C++ | #pragma comment(linker, "/STACK:36777216")
#include <bits/stdc++.h>
using namespace std;
#define LSON id << 1 , l , mid
#define RSON id << 1 | 1 , mid + 1 , r
#define ROOT 1 , 1 , n
#define CLR(x , y) memset(x , y , sizeof(x))
#define LOWBIT(x) x & (-x)
#define FORN(i , a , n) for(int i = (a) ; i <= (n) ; ++i)
#define FORP(i , n , a) for(int i = (n) ; i >= (a) ; --i)
#define CASE(x) printf("Case %d: ", x)
#define SFD(x) scanf("%lf" , &x)
#define SFC(x) scanf(" %c" , &x)
#define SFS(x) scanf(" %s" , x)
#define SFI(x) scanf("%d" , &x)
#define SFL(x) scanf("%lld" , &x)
#define SFI64(x) scanf("%I64d" , &x)
#define PFF(x) printf("%f" , x)
#define PFD(x) printf("%lf" , x)
#define PFI(x) printf("%d" , x)
#define PFC(x) printf("%c" , x)
#define PFS(x) printf("%s" , x)
#define PFI64(x) printf("%I64d" , x)
#define PFL(x) printf("%lld" , x)
#define SPACE printf(" ")
#define PUT puts("")
#define LPUP(i , j , k) for(int i = j ; i <= k ; ++i)
#define LPDW(i , j , k) for(int i = j ; i >= k ; --i)
#define PB(x) push_back(x)
#define ALL(A) A.begin(), A.end()
#define SZ(A) int((A).size())
#define LBD(A, x) (lower_bound(ALL(A), x) - A.begin())
#define UBD(A, x) (upper_bound(ALL(A), x) - A.begin())
#define LOCAL
static const double PI = acos(-1.0);
static const double EPS = 1e-8;
static const int INF = 0X3fffffff;
typedef __int64 LL;
typedef double DB;
template<class T> inline
T read(T &x)
{
x = 0;
int f = 1 ; char ch = getchar();
while (ch < '0' || ch > '9') {if (ch == '-') f = -1; ch = getchar();}
while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
x *= f;
}
/************************Little Pea****************************/
LL t;
int n;
LL p;
LL now;
int main()
{
#ifndef ONLINE_JUDGE
//freopen("D:\\系统优化\\Desktop\\littlepea\\in.data" , "r" , stdin);
#endif
read(n);read(t);
LL pre = 0;
LPUP(i , 1 , n)
{
read(p);
if(p >= now)
{
now += t;
}
else
{
now += (p - pre);
}
pre = p;
}
PFI64(now);
#ifndef ONLINE_JUDGE
fclose(stdin), fclose(stdout);
#endif
}
| a.cc:39:9: error: '__int64' does not name a type; did you mean '__int64_t'?
39 | typedef __int64 LL;
| ^~~~~~~
| __int64_t
a.cc:53:1: error: 'LL' does not name a type; did you mean 'ALL'?
53 | LL t;
| ^~
| ALL
a.cc:55:1: error: 'LL' does not name a type; did you mean 'ALL'?
55 | LL p;
| ^~
| ALL
a.cc:56:1: error: 'LL' does not name a type; did you mean 'ALL'?
56 | LL now;
| ^~
| ALL
a.cc: In function 'int main()':
a.cc:62:18: error: 't' was not declared in this scope; did you mean 'tm'?
62 | read(n);read(t);
| ^
| tm
a.cc:63:5: error: 'LL' was not declared in this scope; did you mean 'ALL'?
63 | LL pre = 0;
| ^~
| ALL
a.cc:66:14: error: 'p' was not declared in this scope
66 | read(p);
| ^
a.cc:67:17: error: 'now' was not declared in this scope; did you mean 'pow'?
67 | if(p >= now)
| ^~~
| pow
a.cc:73:25: error: 'pre' was not declared in this scope; did you mean 'pread'?
73 | now += (p - pre);
| ^~~
| pread
a.cc:75:9: error: 'pre' was not declared in this scope; did you mean 'pread'?
75 | pre = p;
| ^~~
| pread
a.cc:77:11: error: 'now' was not declared in this scope; did you mean 'pow'?
77 | PFI64(now);
| ^~~
a.cc:24:41: note: in definition of macro 'PFI64'
24 | #define PFI64(x) printf("%I64d" , x)
| ^
a.cc: In instantiation of 'T read(T&) [with T = int]':
a.cc:62:9: required from here
62 | read(n);read(t);
| ~~~~^~~
a.cc:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
49 | }
| ^
|
s288498720 | p03731 | C++ | include<iostream>
#include <stdio.h>
using namespace std;
int main()
{
long N, T,i,j,S;
N = 0;
T = 0;
S = 0;
int a[200000];
cin >> N, T;
for (i = 0; i > N; i++){
cin >> a[i];
}
for (j = 0; j > N; j++) {
if (a[j] < T)
S = S + a[j];
else
S = S + T;
}
cout << S;
cin >> j;
return 0;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:13:9: error: 'cin' was not declared in this scope
13 | cin >> N, T;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include <stdio.h>
+++ |+#include <iostream>
3 |
a.cc:30:9: error: 'cout' was not declared in this scope
30 | cout << S;
| ^~~~
a.cc:30:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s295455873 | p03731 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int i=1;
int n=sc.nextInt();
long T=sc.nextLong();
long[] t=new long[n];
long rtn=0;
t[0]=sc.nextLong();
for(i;i<n;i++){
t[i]=sc.nextLong();
rtn+=Math.min(T,t[i]-t[i-1]);
}
System.out.println(rtn);
}
} | Main.java:11: error: not a statement
for(i;i<n;i++){
^
1 error
|
s934982219 | p03731 | C++ | #include <iostream>
#include <list>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
int main()
{
int n, t;
cin >> n;
cin >> t;
vector <int> v;
for (int i = 0; i < n; ++i)
{
int a;
cin >> a;
v.emplace_back(a);
}
int res = 0;
for (size_t i = 0; i < v.size(); ++i)
{
res += t;
if (i + 1 < v.size())
{
if (t >= v[i + 1] - v[i])
{
res -= t - (v[i + 1] - v[i]9;
}
}
}
cout << res;
} | a.cc: In function 'int main()':
a.cc:35:60: error: expected ')' before numeric constant
35 | res -= t - (v[i + 1] - v[i]9;
| ~ ^
| )
|
s371449421 | p03731 | C++ | //#include "flyugelMap2.h"
#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
int main()
{
int n, t;
cin >> n;
cin >> t;
vector <int> v;
for (int i = 0; i < n; ++i)
{
int a;
cin >> a;
v.emplace_back(a);
}
int res = 0;
for (size_t i = 0; i < v.size(); ++i)
{
res += t;
if (i + 1 < v.size())
{
if (t >= v[i + 1] - v[i])
{
res -= t - v[i + 1] - v[i];
}
}
}
| a.cc: In function 'int main()':
a.cc:40:10: error: expected '}' at end of input
40 | }
| ^
a.cc:12:1: note: to match this '{'
12 | {
| ^
|
s756974148 | p03731 | C++ | #include<iostream>
#include <algorithm>
#include<stdint>
using namespace std;
int main() {
int n, t, f, l;
int64_t sum = 0;
cin >> n >> t >> f;
for (int i = 0;i < n - 1;i ++) {
cin >> l;
sum += min(l-f, t);
f = l;
}
cout << sum+t;
} | a.cc:3:9: fatal error: stdint: No such file or directory
3 | #include<stdint>
| ^~~~~~~~
compilation terminated.
|
s396758425 | p03731 | C++ | include <iostream>
using namespace std;
int main()
{
int n,t,a,b,c=0;
cin>>n>>t;
int tab[n];
for(int i=0;i<n;i++){
cin>>tab[i];
}
for(int i=0;i<n-1;i++){
if(tab[i+1]-tab[i]>=t) c+=t;
else c+=tab[i+1]-tab[i];
}
cout<<c;
}
| a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:1: error: 'cin' was not declared in this scope
8 | cin>>n>>t;
| ^~~
a.cc:17:1: error: 'cout' was not declared in this scope
17 | cout<<c;
| ^~~~
|
s497205896 | p03732 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 5;
// input
int N, W;
vector<int> w, v;
vector<map<ll, ll>> m;
void input() {
cin >> N >> W;
w = v = vector<int>(N);
rep(i, N) cin >> w[i] >> v[i];
}
int main() {
input();
m = vector<map<ll, ll>>(N + 1);
rep(k, N + 1) rep(i, k + 1) rep(j, 4 * i) m[k][i * w[0] + j] = -INF;
m[0][0] = 0;
for (int i = 1; i <= N; i++) {
rep(j, i + 1) rep(k, 4 * j) {
int x = j * w[0] + k;
if (W < x) continue;
m[i][x] = m[i - 1][x];
int y = x - w[i - 1];
if (m[i - 1].count(y)) m[i][x] = max(m[i][x], m[i - 1][y] + v[i - 1]);
}
}
int ans = 0;
rep(i, N + 1) rep(j, 4 * i) ans = max(ans, m[N][i * w[0] + j]);
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:38:42: error: no matching function for call to 'max(int&, std::map<long long int, long long int>::mapped_type&)'
38 | rep(i, N + 1) rep(j, 4 * i) ans = max(ans, m[N][i * w[0] + j]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:38:42: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::map<long long int, long long int>::mapped_type' {aka 'long long int'})
38 | rep(i, N + 1) rep(j, 4 * i) ans = max(ans, m[N][i * w[0] + j]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:38:42: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
38 | rep(i, N + 1) rep(j, 4 * i) ans = max(ans, m[N][i * w[0] + j]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
|
s397853945 | p03732 | C++ | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define itn int
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;
ll dp[110][10101010];
int main(){
rep(i,110)rep(j,10101010){
dp[i][j]=inf;
}
ll n,W; cin >> n >> W;
vector<ll> w(n);
vector<ll> v(n);
rep(i,n) cin >> w[i] >> v[i];
dp[0][0]=0;
rep(i,n)rep(j,10101010){
if(j+v[i]<10101010) chmin(dp[i+1][j+v[i]],dp[i][j]+w[i]);
chmin(dp[i+1][j],dp[i][j]);
}
ll ans=0;
rep(j,10101010){
if(dp[n][j]<=W) ans=j;
}
cout << ans << endl;
}
| /tmp/ccEsf2zI.o: in function `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)':
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccEsf2zI.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x26): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccEsf2zI.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x4c): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccEsf2zI.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x5b): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccEsf2zI.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccEsf2zI.o
collect2: error: ld returned 1 exit status
|
s757980767 | p03732 | C++ | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define itn int
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;
ll dp[110][10000100];
int main(){
rep(i,110)rep(j,10000010){
dp[i][j]=inf;
}
ll n,W; cin >> n >> W;
vector<ll> w(n);
vector<ll> v(n);
rep(i,n) cin >> w[i] >> v[i];
dp[0][0]=0;
rep(i,n)rep(j,10000010){
if(j+v[i]<10000010) chmin(dp[i+1][j+v[i]],dp[i][j]+w[i]);
chmin(dp[i+1][j],dp[i][j]);
}
ll ans=0;
rep(j,100010){
if(dp[n][j]<=W) ans=j;
}
cout << ans << endl;
}
| /tmp/ccDkI2Zq.o: in function `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)':
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccDkI2Zq.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x26): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccDkI2Zq.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x4c): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccDkI2Zq.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x5b): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccDkI2Zq.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccDkI2Zq.o
collect2: error: ld returned 1 exit status
|
s888436876 | p03732 | C++ | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define itn int
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;
ll dp[110][10000100];
int main(){
rep(i,110)rep(j,100010){
dp[i][j]=inf;
}
ll n,W; cin >> n >> W;
vector<ll> w(n);
vector<ll> v(n);
rep(i,n) cin >> w[i] >> v[i];
dp[0][0]=0;
rep(i,n)rep(j,10000010){
if(j+v[i]<10000010) chmin(dp[i+1][j+v[i]],dp[i][j]+w[i]);
chmin(dp[i+1][j],dp[i][j]);
}
ll ans=0;
rep(j,100010){
if(dp[n][j]<=W) ans=j;
}
cout << ans << endl;
}
| /tmp/ccmx7e45.o: in function `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)':
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccmx7e45.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x26): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccmx7e45.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x4c): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccmx7e45.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x5b): relocation truncated to fit: R_X86_64_PC32 against symbol `guard variable for __gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZGVZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccmx7e45.o
a.cc:(.text._ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_[_ZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_]+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_debug::_Error_formatter::_S_at(char const*, unsigned int, char const*)::__formatter' defined in .bss._ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter[_ZZN11__gnu_debug16_Error_formatter5_S_atEPKcjS2_E11__formatter] section in /tmp/ccmx7e45.o
collect2: error: ld returned 1 exit status
|
s707917066 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
ll dp[105][20000];
ll cost[1000],weight[1000];
ll value,task,a;
ll O_1knapsack(ll n,ll val)
{
int i,w;
for(i=0; i<=n; i++)
for(w=0; w<=val; w++)
{
if (i==0 || w==0)
dp[i][w] = 0;
else if(weight[i-1]<=w)
{
if(cost[i-1]+dp[i-1][w-weight[i-1]]>=dp[i-1][w])
{
dp[i][w]=cost[i-1]+dp[i-1][w-weight[i-1]];
}
else
{
dp[i][w]=dp[i-1][w];
}
}
else
dp[i][w]=dp[i-1][w];
}
return dp[n][val];
}
int main()
{
//freopen("output.txt", "w", stdout);
int i;
cin>>task>>value;
for( i=0; i<task; i++)
{
cin>>weight[i]>>cost[i];
}
a=O_1knapsack(task,value);
cout<<a<<endl;
return 0;
}
| a.cc:3:1: error: 'll' does not name a type
3 | ll dp[105][20000];
| ^~
a.cc:4:1: error: 'll' does not name a type
4 | ll cost[1000],weight[1000];
| ^~
a.cc:5:1: error: 'll' does not name a type
5 | ll value,task,a;
| ^~
a.cc:6:1: error: 'll' does not name a type
6 | ll O_1knapsack(ll n,ll val)
| ^~
a.cc: In function 'int main()':
a.cc:37:10: error: 'task' was not declared in this scope
37 | cin>>task>>value;
| ^~~~
a.cc:37:16: error: 'value' was not declared in this scope
37 | cin>>task>>value;
| ^~~~~
a.cc:40:14: error: 'weight' was not declared in this scope
40 | cin>>weight[i]>>cost[i];
| ^~~~~~
a.cc:40:25: error: 'cost' was not declared in this scope; did you mean 'cosl'?
40 | cin>>weight[i]>>cost[i];
| ^~~~
| cosl
a.cc:43:5: error: 'a' was not declared in this scope
43 | a=O_1knapsack(task,value);
| ^
a.cc:43:7: error: 'O_1knapsack' was not declared in this scope
43 | a=O_1knapsack(task,value);
| ^~~~~~~~~~~
|
s105262853 | p03732 | C++ |
using namespace std;
int N, W;
int w[100], v[100];
int dp(int num, int weight) {
if(num == N){
return 0;
} else if (weight < w[num]) {
return dp(num+1, weight);
} else {
return max(dp(num+1, weight),
dp(num+1, weight -w[num]) + v[num]);
}
}
int main(){
cin >> N >> W;
for(int i = 0; i < N; i++) {
cin >> w[i] >> v[i];
}
int ret = dp(0, W);
cout << ret << endl;
return 0;
}
| a.cc: In function 'int dp(int, int)':
a.cc:13:12: error: 'max' was not declared in this scope
13 | return max(dp(num+1, weight),
| ^~~
a.cc: In function 'int main()':
a.cc:19:3: error: 'cin' was not declared in this scope
19 | cin >> N >> W;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 |
a.cc:26:3: error: 'cout' was not declared in this scope
26 | cout << ret << endl;
| ^~~~
a.cc:26:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:26:18: error: 'endl' was not declared in this scope
26 | cout << ret << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 |
|
s210453548 | p03732 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<int(n); i++)
using namespace std;
typedef long long LL;
const int N=101;
LL W[N],V[N];
int main() {
LL n,w;
scanf("%lld %lld", &n, &w);
REP(i,n) scanf("%lld %lld", W+i, V+i);
vector<LL> ws;
map<int,vector<LL>> mp;
REP(i,n) {
ws.push_back(W[i]);
mp[W[i]].push_back(V[i]);
}
sort(ws.begin(),ws.end());
ws.erase(unique(ws.begin(),ws.end()),ws.end());
for ( int i:ws ) {
sort(mp[i].rbegin(),mp[i].rend());
for ( int j=1; j<mp[i].size(); j++ ) {
mp[i][j]+=mp[i][j-1];
}
}
if ( ws.size()==1 ) {
int k=w/ws[0];
k=min(n,k);
if ( k==0 ) cout << 0 << '\n';
else cout << mp[ws[0]][k-1] << '\n';
}
if ( ws.size()==2 ) {
LL ans=0;
for ( int i=0; i<=mp[ws[0]].size(); i++ ) {
for ( int j=0; j<=mp[ws[1]].size(); j++ ) {
if ( ws[0]*i+ws[1]*j>w ) continue;
LL res=0;
if ( i>0 ) res+=mp[ws[0]][i-1];
if ( j>0 ) res+=mp[ws[1]][j-1];
ans=max(ans,res);
}
}
cout << ans << '\n';
}
if ( ws.size()==3 ) {
LL ans=0;
for ( int i=0; i<=mp[ws[0]].size(); i++ ) {
for ( int j=0; j<=mp[ws[1]].size(); j++ ) {
for ( int k=0; k<=mp[ws[2]].size(); k++ ) {
if ( ws[0]*i+ws[1]*j+ws[2]*k>w ) continue;
LL res=0;
if ( i>0 ) res+=mp[ws[0]][i-1];
if ( j>0 ) res+=mp[ws[1]][j-1];
if ( k>0 ) res+=mp[ws[2]][k-1];
ans=max(ans,res);
}
}
}
cout << ans << '\n';
}
if ( ws.size()==4 ) {
LL ans=0;
for ( int i=0; i<=mp[ws[0]].size(); i++ ) {
for ( int j=0; j<=mp[ws[1]].size(); j++ ) {
for ( int k=0; k<=mp[ws[2]].size(); k++ ) {
int l=w-ws[0]*i-ws[1]*j-ws[2]*k;
l/=ws[3];
if ( l<0||l>mp[ws[3]].size() ) continue;
LL res=0;
if ( i>0 ) res+=mp[ws[0]][i-1];
if ( j>0 ) res+=mp[ws[1]][j-1];
if ( k>0 ) res+=mp[ws[2]][k-1];
if ( l>0 ) res+=mp[ws[3]][l-1];
ans=max(ans,res);
}
}
}
cout << ans << '\n';
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:29:14: error: no matching function for call to 'min(LL&, int&)'
29 | k=min(n,k);
| ~~~^~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:29:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
29 | k=min(n,k);
| ~~~^~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:29:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
29 | k=min(n,k);
| ~~~^~~~~
|
s902654528 | p03732 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const double PI = acos(-1.0);
// cout << fixed << setprecision(14);
signed main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N, W;
cin >> N >> W;
P p[N];
rep(i,N){
cin >> p[i].first >> p[i].second;
}
sort(p,p+N);
if(p[0].first > 300){
int K = W/p[0].first;
W = W % p[0].first;
if(K > N){
int ans = 0;
rep(i,N){
ans += p[i].second;
}
cout << ans << endl;
return 0;
}
int _ = p[0].first;
rep(i,N){
p[i].first -= _;
}
int dp[N+1][K+1][500]{};
rep(i,N){
rep(j,K+1){
rep(k,400){
chmax(dp[i+1][j][k], dp[i][j][k]);
if(j>0 && k-p[i].first>=0){
chmax(dp[i+1][j][k], dp[i][j-1][k-p[i].first]+p[i].second);
}
}
}
}
cout << dp[N][K][min(W,350)] << endl;
}
else{
W = min(W, N*p[N-1].first);
int dp[N+1][W+1]{};
dp[0][0] = 0;
rep(i,N){
rep(j,W+1){
chmax(dp[i+1][j], dp[i][j]);
if(j-p[i].first>=0){
chmax(dp[i+1][j], dp[i][j-p[i].first]+p[i].second);
}
}
}
cout << dp[N][W] << endl;
}
} | a.cc: In function 'int main()':
a.cc:51:37: error: no matching function for call to 'min(long long int&, int)'
51 | cout << dp[N][K][min(W,350)] << endl;
| ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:51:37: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
51 | cout << dp[N][K][min(W,350)] << endl;
| ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:51:37: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
51 | cout << dp[N][K][min(W,350)] << endl;
| ~~~^~~~~~~
|
s947364203 | p03732 | C++ | /*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define vi vector<int>
#define dbg(x) cerr << #x << " = " << x << '\n'
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define pii pair<int,int>
using namespace std;
int n,w;
vector <pii> v;
map <pii,int> mp;
int fun(int i,int j){
if (j>w) return INT_MIN;
if (i==n) return 0;
if (mp.count({i,j})) return mp[{i,j}];
return mp[{i,j}] = max(fun(i+1,j),fun(i+1,j+v[i].ff)+v[i].ss);
}
inline void solve(){
cin>>n>>w;
v.resize(n);
for (int i=0;i<n;i++){
int a,b; cin>>a>>b;
v[i].ff=a;
v[i].ss=b;
}
cout << fun(0,0) << endl;
}
signed main()
{
int n=1; // cin>>n;
while (n--) solve();
return 0;
}
| a.cc: In function 'long long int fun(long long int, long long int)':
a.cc:32:21: error: 'INT_MIN' was not declared in this scope
32 | if (j>w) return INT_MIN;
| ^~~~~~~
a.cc:15:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
14 | #include <queue>
+++ |+#include <climits>
15 | #define mod 998244353
|
s124860213 | p03732 | C++ | 123 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 123
| ^~~
|
s847072831 | p03732 | C++ | // abc060_d
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()
#define INF ((1 << 29)-1)
#define MOD (1000000007)
#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;
int N, T;
vector<ll> W, V;
void dp_rec(){
}
int main() {
#ifdef LOCAL
ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif
cin >> N >> T;
W.assign(N, 0);
V.assign(N, 0);
REP(i, N) cin >> W[i] >> V[i];
map<ll, ll> dp;
dp[0] = 0;
REP(i, N){
auto dp_prev = dp;
for (auto e: dp_prev){
ll w = e.first;
ll v = e.second;
ll tmp = dp[w + W[i]];
dp[w + W[i]] = max(tmp , v + V[i]);
}
print(dp);
}
ll ans = 0;
for (auto e: dp){
ll w = e.first;
ll v = e.second;
if (w <= T){
ans = max(ans, v);
}
}
print(ans);
return 0;
}
| a.cc: In instantiation of 'void print(const T&) [with T = std::map<long long int, long long int>]':
a.cc:56:14: required from here
56 | print(dp);
| ~~~~~^~~~
a.cc:23:47: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const std::map<long long int, long long int>')
23 | template<class T> void print(const T& x){cout << x << endl;}
| ~~~~~^~~~
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:2:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'const std::map<long long int, long long int>' to 'const void*'
301 | operator<<(const void* _ |
s410233771 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,w;
cin>>n>>w;
vector<int> wt(n);
vector<int> v(n);
for(int i=0;i<n;i++)
cin>>wt[i];
for(int i=0;i<n;i++)
cin>>v[i];
int dp[n+1][w+1];
for(int i=0;i<n+1;i++)
dp[i][0]=0;
for(int i=0;i<w+1;i++)
dp[0][i]=1;
for(int i=1;i<n+1;i++)
{
for(int j=1;j<w+1;j++)
{
if(wt[i-1]<=j)
dp[i][j]= max(v[i-1]+dp[i-1][j-wt[i-1]] + dp[i-1][j];
else
dp[i][j]=dp[i-1][j];
}
}
cout<<dp[n][w]<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:29:59: error: expected ')' before ';' token
29 | dp[i][j]= max(v[i-1]+dp[i-1][j-wt[i-1]] + dp[i-1][j];
| ~ ^
| )
|
s085600541 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,w;
cin>>n>>w;
vector<int> wt(n);
vector<int> v(n);
for(int i=0;i<n;i++)
cin>>wt[i];
for(int i=0;i<n;i++)
cin>>v[i];
int dp[n+1][w+1];
for(int i=0;i<n+1;i++)
dp[i][0]=0;
for(int i=0;i<w+1;i++)
dp[0][i]=1;
for(int i=1;i<n+1;i++)
{
for(int j=1;j<w+1;j++)
{
if(wt[i-1]<=j)
dp[i][j]= max(val[i-1]+dp[i-1][j-wt[i-1]] + dp[i-1][j];
else
dp[i][j]=dp[i-1][j];
}
}
cout<<dp[n][w]<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:29:21: error: 'val' was not declared in this scope
29 | dp[i][j]= max(val[i-1]+dp[i-1][j-wt[i-1]] + dp[i-1][j];
| ^~~
|
s382934554 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,w;
cin>>n>>w;
vector<int> wt(n);
vector<int> v(n);
for(int i=0;i<n;i++)
cin>>wt[i];
for(int i=0;i<n;i++)
cin>>v[i];
int dp[n+1][w+1];
for(int i=0;i<n+1;i++)
dp[i][0]=0;
for(int i=0;i<w+1;i++)
dp[0][i]=1;
for(int i=1;i<n+1;i++)
{
for(int j=1;j<w+1;j++)
{
if(wt[i-1]<=j)
dp[i][j]= max(val[i-1]+dp[i-1][j-arr[i-1]] + dp[i-1][j];
else
dp[i][j]=dp[i-1][j];
}
}
cout<<dp[n][w]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:29:21: error: 'val' was not declared in this scope
29 | dp[i][j]= max(val[i-1]+dp[i-1][j-arr[i-1]] + dp[i-1][j];
| ^~~
a.cc:29:40: error: 'arr' was not declared in this scope
29 | dp[i][j]= max(val[i-1]+dp[i-1][j-arr[i-1]] + dp[i-1][j];
| ^~~
|
s888728894 | p03732 | C | //#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cctype>
#include <cstdlib> // srand,rand
#include <random>
#include <functional>
using namespace std;
#define ll long long
#define lp(i,n) for(ll i=0;i<n;i++)
#define modd 1000000007
#define mod2 998244353
#define INF 8223372036854775807ll
#define ALL(a) (a).begin(),(a).end()
typedef pair<long long, long long> pl;
typedef pair<double, double> pd;
typedef pair<ll, string> pls;
typedef string::const_iterator State;
class ParseError {};
/*
class SegmentTree {
private:
ll cont_num = 2;
pd initial_v;
vector<pd> dat;
public:
SegmentTree() {};
void init(ll size, double initial_value_first, double initial_value_second) {
cont_num = 2;
initial_v.first = initial_value_first;
initial_v.second = initial_value_second;
while (cont_num < size) {
cont_num *= 2;
}
dat.resize(2 * cont_num);//サイズ設定
for (int i = 0; i < 2 * cont_num; i++)dat[i] = initial_v;//初期化
}
void Update(ll position, double value_f, double value_s) {
ll k = cont_num + position;
dat[k].first = value_f;
dat[k].second = value_s;
while (k > 1) {
k /= 2;
dat[k].first = dat[k * 2 + 1].first * dat[k * 2].first;
dat[k].second = dat[k * 2 + 1].first * dat[k * 2].second + dat[k * 2 + 1].second;
}
}
/*
ll query_proces(ll a, ll b, ll k, ll l, ll r) {
if (r <= a || b <= l)return initial_v;
if (a <= l && r <= b)return dat[k];
else {
ll vl = query_proces(a, b, k * 2, l, (l + r) / 2);
ll vr = query_proces(a, b, k * 2 + 1, (l + r) / 2, r);
return min(vl, vr);
}
}
ll query(ll left, ll right) {
return query_proces(left, right, 1, 0, cont_num);
}
*/
/*
double query() {
return dat[1].first + dat[1].second;
}
};*/
template <typename T>
class Zip {
vector<T> d;
bool flag;
void init() {
sort(d.begin(), d.end());
d.erase(unique(d.begin(), d.end()), d.end());
flag = false;
}
public:
Zip() {
flag = false;
}
void add(T x) {
d.push_back(x);
flag = true;
}
ll getNum(T x) {
if (flag) init();
return lower_bound(d.begin(), d.end(), x) - d.begin();
}
ll size() {
if (flag) init();
return (ll)d.size();
}
};
ll N, M, K, a, b, c, d, e, H, W, L, T;
ll x, y, z;
ll A[2000004] = {};
ll B[2000004] = {};
ll C[2000004] = {};
ll D[1000006] = {};
ll E[1000006] = {};
bool f;
string S[200000];
string SS;
set <long long>sll;
pl bufpl;
vector <long long>vl[200005];
vector <long long>vll;
vector <long long>v;
vector <pl>vpl;
vector <string> vs;
set<ll> llset;
set<string> Sset;
multiset<ll> llmset;
queue<ll> ql;
multiset<pl> plmset;
typedef struct ST
{
ll first;
ll second;
ll cost;
bool operator<(const ST& another) const
{
return cost < another.cost;//比較
};
bool operator>(const ST& another) const
{
return cost > another.cost;//比較
};
}ST;
//queue<ST> qst;
priority_queue<ST, vector<ST>, greater<ST> > qst;
/*vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/
long long modinv(long long aa, long long mm) {
long long bb = mm, uu = 1, vv = 0;
while (bb) {
long long tt = aa / bb;
aa -= tt * bb; swap(aa, bb);
uu -= tt * vv; swap(uu, vv);
}
uu %= mm;
if (uu < 0) uu += mm;
return uu;
}
ll zettai(ll aa) {
if (aa < 0) {
aa *= -1;
}
return aa;
}
float zettai(float aa) {
if (aa < 0) {
aa *= -1;
}
return aa;
}
/*
class UnionFind
{
public:
vector <ll>pairent;
vector <ll>depth;
vector <ll>size;
UnionFind(ll Amount) : pairent(Amount, 1), depth(Amount, 1), size(Amount, 1) {
for (ll i = 0; i < Amount; i++) {
pairent[i] = i;
}
}
ll FindPairent(ll x) {
if (pairent[x] == x)return x;
else return pairent[x] = FindPairent(pairent[x]);
}
ll Merge(ll x, ll y) {
x = FindPairent(x);
y = FindPairent(y);
if (x != y) {
if (depth[x] > depth[y]) {
pairent[y] = pairent[x];
return size[x] += size[y];
}
else {
pairent[x] = pairent[y];
if (depth[x] == depth[y]) {
depth[y] ++;
}
return size[y] += size[x];
}
}
else {
return -1;
}
}
bool IsSame(ll x, ll y) {
if (FindPairent(x) == FindPairent(y))return true;
else return false;
}
ll GetSize(ll x) {
x = FindPairent(x);
return size[x];
}
};
*/
class UnionFind
{
public:
vector <ll>pairent;
vector <ll>depth;
vector <ll>size;
UnionFind(ll Amount) : pairent(Amount, 1), depth(Amount, 1), size(Amount, 1) {
for (ll i = 0; i < Amount; i++) {
pairent[i] = i;
}
}
ll FindPairent(ll x) {
if (pairent[x] == x)return x;
else return pairent[x] = FindPairent(pairent[x]);
}
ll Merge(ll x, ll y) {
x = FindPairent(x);
y = FindPairent(y);
if (x != y) {
if (depth[x] > depth[y]) {
pairent[y] = pairent[x];
return size[x] += size[y];
}
else {
pairent[x] = pairent[y];
if (depth[x] == depth[y]) {
depth[y] ++;
}
return size[y] += size[x];
}
}
else {
return -1;
}
}
bool IsSame(ll x, ll y) {
if (FindPairent(x) == FindPairent(y))return true;
else return false;
}
ll GetSize(ll x) {
x = FindPairent(x);
return size[x];
}
};
struct Edge
{
ll a, b, cost;
bool operator<(const Edge& other) const {
return cost < other.cost;
}
};
struct Graph
{
ll n; // 頂点数
vector<Edge> es; // 辺集合
};
class Kruskal {
Graph origin_G;
Graph MST;
ll total_cost = 0;
public:
void Solve() {
UnionFind uf = UnionFind(MST.n);
for (ll i = 0; i < origin_G.es.size(); i++) {
ll a = origin_G.es[i].a;
ll b = origin_G.es[i].b;
ll cost = origin_G.es[i].cost;
if (!uf.IsSame(a, b)) {
uf.Merge(a, b);
MST.es.push_back(origin_G.es[i]);
total_cost += cost;
}
}
}
Kruskal(Graph graph) {
origin_G = graph;
MST = graph;
MST.es.clear();
sort(origin_G.es.begin(), origin_G.es.end());
}
ll GetMinCost() {
return total_cost;
}
};
ll RepeatSquaring(ll N, ll P, ll M) {
if (P == 0) return 1;
if (P % 2 == 0) {
ll t = RepeatSquaring(N, P / 2, M) % M;
return t * t % M;
}
return N * RepeatSquaring(N, P - 1, M) % M;
}
/*
ll KurikaesiNijou(ll a, ll b, ll P) {
if (b == 0)return 1;
if (b % 2 == 0) {
ll c=KurikaesiNijou(a,b/2,P)%P;
return c * c %P;
}
else {
ll c = KurikaesiNijou(a, b/2, P) % P;
return a * c * c % P;
}
}*/
ll GCD(ll a, ll b) {
if (a % b == 0)return b;
else return GCD(b, a % b);
}
ll Min(ll a, ll b) {
if (a < b)return a;
else return b;
}
ll Max(ll a, ll b) {
if (a > b)return a;
else return b;
}
ll Sum(ll a, ll b) {
return a + b;
}
template <typename T>
class SegmentTree {
ll n;
vector<T> node;
function<T(T, T)> fun, fun2;
bool customChange;
T outValue, initValue;
public:
void init(ll num, function<T(T, T)> resultFunction, T init, T out, function<T(T, T)> changeFunction = NULL) {
// changeFunction: (input, beforevalue) => newvalue
fun = resultFunction;
fun2 = changeFunction;
customChange = changeFunction != NULL;
n = 1;
while (n < num) n *= 2;
node.resize(2 * n - 1);
fill(node.begin(), node.end(), init);
outValue = out;
initValue = init;
}
void valueChange(ll num, T value) {
num += n - 1;
if (customChange) node[num] = fun2(value, node[num]);
else node[num] = value;
while (num > 0) num = (num - 1) / 2, node[num] = fun(node[num * 2 + 1], node[num * 2 + 2]);
}
T rangeQuery(ll a, ll b, ll l = 0, ll r = -1, ll k = 0) { // [a, b)
if (r == -1) r = n;
if (a <= l && r <= b) return node[k];
if (b <= l || r <= a) return outValue;
ll mid = (l + r) / 2;
return fun(rangeQuery(a, b, l, mid, 2 * k + 1), rangeQuery(a, b, mid, r, 2 * k + 2));
}
};
class Combination {
vector<ll> factorial;
vector<ll> factorial_inv;
ll mod;
ll max_n;
public:
void Init(ll init_max_n, ll init_mod) {
max_n = init_max_n;
mod = init_mod;
factorial.resize(max_n + 1);
factorial[0] = 1;
for (ll i = 1; i < factorial.size(); i++) {
factorial[i] = factorial[i - 1] * i;
factorial[i] %= mod;
}
factorial_inv.resize(max_n + 1);
factorial_inv[0] = 1;
for (ll i = 1; i < factorial_inv.size(); i++) {
factorial_inv[i] = factorial_inv[i - 1] * modinv(i, mod);
factorial_inv[i] %= mod;
}
}
ll GetComb(ll n, ll k) {
ll comb = factorial[n];
comb *= factorial_inv[k];
comb %= mod;
comb *= factorial_inv[n - k];
comb %= mod;
return comb;
}
ll GetH(ll n, ll k) {//n+k-1<=max_N
ll comb = factorial[n + k - 1];
comb *= factorial_inv[n];
comb %= mod;
comb *= factorial_inv[k - 1];
comb %= mod;
return comb;
}
};
class Tree {
ll node_N;
vector<ll> node;
vector<vector<pl>> pass;
ll diameter = -1;
vector<ll> dist_Diamieter[2];
pl maxDist_Num;
public:
void Init(ll node_Num) {
node_N = node_Num;
node.resize(node_N + 1);
pass.resize(node_N + 1);
dist_Diamieter[0].resize(node_N + 1);
lp(i, node_N + 1)dist_Diamieter[0][i] = -1;
dist_Diamieter[1].resize(node_N + 1);
lp(i, node_N + 1)dist_Diamieter[1][i] = -1;
}
void AddEdge(ll a, ll b, ll dist) {
bufpl.first = b;
bufpl.second = dist;
pass[a].push_back(bufpl);
bufpl.first = a;
pass[b].push_back(bufpl);
}
void DFS(ll step, ll now, ll dist) {
dist_Diamieter[step][now] = dist;
if (dist_Diamieter[step][now] > maxDist_Num.first) {
maxDist_Num.first = dist_Diamieter[step][now];
maxDist_Num.second = now;
}
for (ll i = 0; i < pass[now].size(); i++) {
ll next_node = pass[now][i].first;
if (dist_Diamieter[step][next_node] == -1) {
DFS(step, next_node, dist + pass[now][i].second);
}
}
}
ll GetDiameter(ll min_node_num) {
if (diameter >= 0)return diameter;
else {
maxDist_Num.first = -1;
maxDist_Num.second = -1;
DFS(0, min_node_num, 0ll);
ll step2_start = maxDist_Num.second;
maxDist_Num.first = -1;
maxDist_Num.second = -1;
DFS(1, step2_start, 0ll);
diameter = maxDist_Num.first;
return diameter;
}
}
ll GetDistFromMinNode(ll num) {
return dist_Diamieter[0][num];
}
};
void Nibu(ll node, ll co) {
C[node] = co % 2;
D[co % 2]++;
lp(i, vl[node].size()) {
ll next = vl[node][i];
if (C[next] == -1) {
Nibu(next, co + 1);
}
}
}
ll dp[105][105][305] = {};
int main() {
cin >> N >> W;
lp(i, N)cin >> A[i] >> B[i];
lp(i, N) {
lp(j, 301)lp(k, 301)dp[i][j][k] = dp[i - 1][j][k];
if (i == 0) {
if (A[i] > W) {
cout << 0 << endl;
return 0;
}
else {
for (ll j = 0; j <= 300; j++)dp[i][1][j] = B[i];
}
}
else {
A[i] -= A[0];
for (ll j = 0; j <= 300 - A[i]; j++) {
for (ll k = 0; k <= i; k++) {
dp[i][k+1][j + A[i]] = max(dp[i][k+1][j + A[i]], dp[i - 1][k][j] + B[i]);
}
}
}
}
ll ans = 0;
lp(i, N+1) {
e = min(300ll, W - A[0]*i);
if (e < 0)break;
ans = max(ans, dp[N-1][i][e]);
}
cout << ans << endl;
//cout << fixed << setprecision(12) << bb << endl;
return 0;
}
| main.c:4:10: fatal error: string: No such file or directory
4 | #include <string>
| ^~~~~~~~
compilation terminated.
|
s592734744 | p03732 | C++ | #include<bitset/std++.h>
using namespace std;
// 入力
int n, W;
int weight[110], value[110];
// DPテーブル
int dp[110][10010];
int main() {
cin >> n >> W;
for (int i = 0; i < n; ++i) cin >> weight[i] >> value[i];
// DP初期条件: dp[0][w] = 0
for (int w = 0; w <= W; ++w) dp[0][w] = 0;
// DPループ
for (int i = 0; i < n; ++i) {
for (int w = 0; w <= W; ++w) {
if (w >= weight[i]) dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w]);
else dp[i+1][w] = dp[i][w];
}
}
cout << dp[n][W] << endl;
} | a.cc:1:9: fatal error: bitset/std++.h: No such file or directory
1 | #include<bitset/std++.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
|
s698648608 | p03732 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vi vector<int>
using ll = long long;
using namespace std;
int main(){
int n,W;
cin >> n >> W;
vi w(n);
vi v(n);
map<int, vi> weights;
rep(i, n){
cin >> w[i] >> v[i];
weights[w[i]].push_back(v[i]);
}
int ans = 0;
int weight = w[0];
for(auto x : weights){
SORT(x.second);
reverse(x.second.begin(), x.second.end());
}
rep(a, weights[weight].size() + 1){
rep(b, weights[weight + 1].size() + 1){
rep(c, weights[weight + 2].size() + 1){
rep(d, weights[weight + 3].size() + 1){
if(a*weight + b*(weight+1) + c*(weight+2) + d*(weight+3) <= W){
int res = 0;
rep(i, a) res += weights[weight][i];
rep(i, b) res += weights[weight + 1][i];
rep(i, c) res += weights[weight + 2][i];
rep(i, d) res += weights[weight + 3][i];
ans = (ans < res) ? res : ans;
}
}
}
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:19:5: error: 'SORT' was not declared in this scope
19 | SORT(x.second);
| ^~~~
|
s491858132 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
int N,W; cin>>N>>W;
int ans=0;
vii A(4);
int memo=0; cin>>memo;
int X; cin>>X;
A[0].push_back(X);
rep(i,0,N-1){
int X,Y; cin>>X>>Y;
A[X-memo].push_back(Y);
}
vii S(4);
rep(i,0,4){
sort(ALL(A[i]),greater<int>());
int sum=0;
S[i].puah_back(0);
rep(j,0,A[i].size()){
sum+=A[i][j];
S[i].push_back(sum);
}
}
REP(i,0,A[0].size()){
REP(j,0,A[1].size()){
REP(k,0,A[2].size()){
REP(l,0,A[3].size()){
int K=i*memo;
K+=j*memo+j;
K+=k*memo+k*2;
K+=l*memo+l*3;
if(K<=W){
int sum=0;
sum+=S[0][i];
sum+=S[1][j];
sum+=S[2][k];
sum+=S[3][l];
ans=max(ans,sum);
}
}
}
}
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:30:10: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'puah_back'; did you mean 'push_back'?
30 | S[i].puah_back(0);
| ^~~~~~~~~
| push_back
|
s159469438 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
int N,W; cin>>N>>W;
int ans=0;
vii A(4);
int memo=0; cin>>memo;
int X; cin>>X;
A[0].push_back(X);
rep(i,0,N-1){
int X,Y; cin>>X>>Y;
A[X-memo].push_back(Y);
}
vii S(4);
rep(i,0,4){
sort(ALL(A[i]),greater<int>());
int sum=0;
S[i].puah_back(0);
rep(j,0,A[i].size()){
sum+=A[i][j];
S[i].puah_back(sum);
}
}
REP(i,0,A[0].size()){
REP(j,0,A[1].size()){
REP(k,0,A[2].size()){
REP(l,0,A[3].size()){
int K=i*memo;
K+=j*memo+j;
K+=k*memo+k*2;
K+=l*memo+l*3;
if(K<=W){
int sum=0;
sum+=S[0][i];
sum+=S[1][j];
sum+=S[2][k];
sum+=S[3][l];
ans=max(ans,sum);
}
}
}
}
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:30:10: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'puah_back'; did you mean 'push_back'?
30 | S[i].puah_back(0);
| ^~~~~~~~~
| push_back
a.cc:33:12: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'puah_back'; did you mean 'push_back'?
33 | S[i].puah_back(sum);
| ^~~~~~~~~
| push_back
|
s173266213 | p03732 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,W;
cin>>N>>W;
vector<int> w(N),v(N);
for(int i=0;i<N;i++){
cin>>w.at(i)>>v.at(i);
}
vector<int> value(W+1,0);
if(w.at(0)<=W){
value.at(w.at(0))=v.at(0);
}
for(int i=1;i<N;i++){
for(int j=w.(i);j+w.at(i)<=W;j++){
value.at(j+w.at(i))=max(value.at(j+w.at(i)),value.at(j)+v.at(i));
}
}
int ans=1;
for(int i=0;i<W+1;i++){
ans=max(ans,value.at(i));
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:17:17: error: expected unqualified-id before '(' token
17 | for(int j=w.(i);j+w.at(i)<=W;j++){
| ^
|
s169178243 | p03732 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
int main(void) {
int N;
int64_t W;
cin >> N >> W;
vector< vector<int64_t> > v(4);
--N;
int w0, v0;
cin >> w0 >> v0;
v[0].push_back(v0);
while(N--) {
int w, v;
cin >> w >> v;
v[w-w0].push_back(v);
}
for(auto e: v) {
sort(e.begin(), e.end());
e.push_back(0);
reverse(e.begin(), e.end());
partial_sum(e.begin(), e.end(), e.begin());
}
int64_t ans = 0;
for(int64_t i=0; i<v[0].size(); i++) {
for(int64_t j=0; j<v[1].size(); j++) {
for(int64_t k=0; k<v[2].size(); k++) {
for(int64_t l=0; l<v[3].size(); l++) {
if(w0*(i+j+k+l) + j + 2*k + 3*l <= W) {
ans = max(ans, v[0][i] + v[1][j] + v[2][k] + v[3][l]);
}
}
}
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:10: error: invalid types 'int[int]' for array subscript
20 | v[w-w0].push_back(v);
| ^
|
s396915438 | p03732 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;
#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る マクロで #define vvint(N,M) vector<vector<int>>
using namespace std;
ll dp[1002][MOD];
ll w[1002],v[1002];
void knapsack(ll i, ll wi){
i++;
wi++;
if(wi < w[i]){
dp[i][wi] = dp[i-1][wi];
}else{
dp[i][wi] = max(dp[i-1][wi],dp[i-1][wi-w[i]]+v[i]);
}
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N,W;
cin >> N >> W;
for(int i = 0; i < N+2;i++){
for(int l = 0; l < W+2;l++){
dp[i][l] = 0;
}
}
for(int i = 1; i < N+1;i++){
cin >> w[i] >> v[i];
}
for(int i = 0; i < N;i++){
for(int l = 0; l < W;l++){
knapsack(i,l);
}
}
// for(int i = 0; i < N+2;i++){
// for(int l = 0; l < W+2;l++){
// cout << dp[i][l] << " ";
// }
// cout << endl;
// }
cout << dp[N][W] << endl;
return 0;
} | /tmp/ccQBrpgA.o: in function `knapsack(long long, long long)':
a.cc:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccQBrpgA.o
a.cc:(.text+0xa1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccQBrpgA.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccQBrpgA.o
/tmp/ccQBrpgA.o: in function `main':
a.cc:(.text+0x210): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccQBrpgA.o
a.cc:(.text+0x23c): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccQBrpgA.o
collect2: error: ld returned 1 exit status
|
s299380880 | p03732 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;
#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る マクロで #define vvint(N,M) vector<vector<int>>
using namespace std;
int N,W;
ll dp[1002][MOD];
ll w[1002],v[1002];
void knapsack(ll i, ll wi){
i++;
wi++;
if(wi < w[i]){
dp[i][wi] = dp[i-1][wi];
}else{
dp[i][wi] = max(dp[i-1][wi],dp[i-1][wi-w[i]]+v[i]);
}
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> W;
for(int i = 0; i < N+2;i++){
for(int l = 0; l < W+2;l++){
dp[i][l] = 0;
}
}
for(int i = 1; i < N+1;i++){
cin >> w[i] >> v[i];
}
for(int i = 0; i < N;i++){
for(int l = 0; l < W;l++){
knapsack(i,l);
}
}
// for(int i = 0; i < N+2;i++){
// for(int l = 0; l < W+2;l++){
// cout << dp[i][l] << " ";
// }
// cout << endl;
// }
cout << dp[N][W] << endl;
return 0;
} | /tmp/ccDuJreq.o: in function `knapsack(long long, long long)':
a.cc:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccDuJreq.o
a.cc:(.text+0xa1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccDuJreq.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccDuJreq.o
/tmp/ccDuJreq.o: in function `main':
a.cc:(.text+0x21c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccDuJreq.o
a.cc:(.text+0x248): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccDuJreq.o
collect2: error: ld returned 1 exit status
|
s529556458 | p03732 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;
#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る マクロで #define vvint(N,M) vector<vector<int>>
using namespace std;
int N,W;
ll dp[1002][MOD];
ll w[1002],v[1002];
void knapsack(ll i, ll wi){
i++;
wi++;
if(wi < w[i]){
dp[i][wi] = dp[i-1][wi];
}else{
dp[i][wi] = max(dp[i-1][wi],dp[i-1][wi-w[i]]+v[i]);
}
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> W;
for(int i = 0; i < N+2;i++){
for(int l = 0; l < W+2;l++){
dp[i][l] = 0;
}
}
for(int i = 1; i < N+1;i++){
cin >> w[i] >> v[i];
}
for(int i = 0; i < N;i++){
for(int l = 0; l < W;l++){
knapsack(i,l);
}
}
for(int i = 0; i < N+2;i++){
for(int l = 0; l < W+2;l++){
cout << dp[i][l] << " ";
}
cout << endl;
}
return 0;
} | /tmp/cckzq5u4.o: in function `knapsack(long long, long long)':
a.cc:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckzq5u4.o
a.cc:(.text+0xa1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckzq5u4.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckzq5u4.o
/tmp/cckzq5u4.o: in function `main':
a.cc:(.text+0x21c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckzq5u4.o
a.cc:(.text+0x248): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckzq5u4.o
collect2: error: ld returned 1 exit status
|
s092363473 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
int N,W;
cin>>N>>W;
vector<pii> A(N);
rep(i,0,N) cin>>A.at(i).first>>A.at(i).second;
vii dp(N+1,vi(W+1));
REP(i,1,N){
REP(j,1,W){
if(A.at(i-1).first<=j)
dp.at(i).at(j)=max(dp.at(i-1).at(j-A.at(i-1).first)+A.at(i-1).second,1);//dp.at(i-1).at(j));
else
dp.at(i).at(j)=dp.at(i-1).at(j);
}
}
cout<<dp.at(N).at(W)<<endl;
}
| a.cc: In function 'int main()':
a.cc:24:27: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)'
24 | dp.at(i).at(j)=max(dp.at(i-1).at(j-A.at(i-1).first)+A.at(i-1).second,1);//dp.at(i-1).at(j));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:24:27: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
24 | dp.at(i).at(j)=max(dp.at(i-1).at(j-A.at(i-1).first)+A.at(i-1).second,1);//dp.at(i-1).at(j));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:24:27: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
24 | dp.at(i).at(j)=max(dp.at(i-1).at(j-A.at(i-1).first)+A.at(i-1).second,1);//dp.at(i-1).at(j));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s735255132 | p03732 | C++ | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
int main(void)
{
IOS
const int N = 4;
ll n, w;
cin >> n >> w;
vector<vector<int>> vv(N,vector<int>());
ll w1,v1;
cin >> w1 >> v1;
vv[0].push_back(v1);
REP(i,n-1) {
int w, v;
cin >> w >> v;
vv[w-w1].push_back(v);
}
for(auto v:vv) sort(RALL(v));
vector<vector<ll>> vsum(N,vector<ll>{0});
REP(i,N) REP(j,vv[i].size()) {
//cerr << i << j << endl;
vsum[i].push_back(vsum[i][j] + vv[i][j]);
}
int ans = 0;
for (ll i = 0; i < vsum[0].size(); i++) {
ll wi = w1 * i;
if (wi > w) break;
for (ll j = 0; j < vsum[1].size(); j++) {
ll wj = wi + (w1+1) * j;
if (wj > w) break;
for(ll k = 0; k < vsum[2].size(); k++) {
ll wk = wj + (w1+2) * k;
if (wk > w) break;
for(ll l = 0; l < vsum[3].size(); l++) {
ll wl = wk + (w1+3) * l;
if (wl > w) break;
//cerr << i << j << k << l << " " << wl << endl;
ans = max(ans,vsum[0][i]+vsum[1][j]+vsum[2][k]+vsum[3][l]);
}
}
}
}
cout << ans << '\n';
return 0;
} | a.cc: In function 'int main()':
a.cc:55:30: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
55 | ans = max(ans,vsum[0][i]+vsum[1][j]+vsum[2][k]+vsum[3][l]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:55:30: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
55 | ans = max(ans,vsum[0][i]+vsum[1][j]+vsum[2][k]+vsum[3][l]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:55:30: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
55 | ans = max(ans,vsum[0][i]+vsum[1][j]+vsum[2][k]+vsum[3][l]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s486479571 | p03732 | C++ | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
int main(void)
{
IOS
ll n, w;
cin >> n >> w;
vector<ll> vv(n) , vw(n);
REP(i,n) cin >> vw[i] >> vv[i];
int w1 = vw[0];
int ans = 0;
vector<vector<vector<int>>> dp(n+1,vector<vector<int>>(n+1,vector<int>(n*3)));
REP(i,n) for(int j = i; j>=0;j--) for(int k = j*3;k >= 0;k--) {
//cerr << "dp" << i << j << k << endl;
if (w1 * j + k + vw[i] <= w) {
//cerr << i << " " << j << " " << k + vw[i] - w1 << " " << w1 * j + k + vw[i] << " " << dp[i][j][k] + vv[i]<< endl;
dp[i+1][j+1][k + vw[i] - w1] = max(dp[i+1][j+1][k + vw[i] - w1], dp[i][j][k] + vv[i]);
ans = max(ans,dp[i+1][j+1][k + vw[i] - w1]);
}
//cerr << i << " "<< j << " " << k << " "<< dp[i][j][k] << endl;
dp[i+1][j][k] = dp[i][j][k];
}
cout << ans << '\n';
return 0;
} | a.cc: In function 'int main()':
a.cc:32:47: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
32 | dp[i+1][j+1][k + vw[i] - w1] = max(dp[i+1][j+1][k + vw[i] - w1], dp[i][j][k] + vv[i]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:32:47: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
32 | dp[i+1][j+1][k + vw[i] - w1] = max(dp[i+1][j+1][k + vw[i] - w1], dp[i][j][k] + vv[i]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:32:47: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
32 | dp[i+1][j+1][k + vw[i] - w1] = max(dp[i+1][j+1][k + vw[i] - w1], dp[i][j][k] + vv[i]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s675050238 | p03732 | C++ | 4 6
2 1
3 4
4 10
3 4 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 4 6
| ^
|
s315040411 | p03732 | C++ | #define _GLIBCXX_DEBUG//TLEの原因になるので注意!!!!!!!!!!!
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long
//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある
ll d[101][1000000005];
ll w[105];
ll v[105];
int main(){
ll n,W;
cin >> n>>W;
ll l=0;
rep(i,n){
cin >> w[i]>>v[i];
//l=(w[0]+3)*(i+2);
if(i==0){
rep(j,w[0]){
d[0][j]=0;
}
reps(j,w[0],W){
d[0][j]=v[0];
}
}else{
rep(j,W+1){
if(j-w[i]>=0){
d[i][j]=max(d[i-1][j],d[i-1][j-w[i]]+v[i]);
}else{
d[i][j]=d[i-1][j];
}
}
}
}
/*
rep(i,n){
rep(j,W+1){
cerr<<d[i][j]<<' ';
}
cerr<<endl;
}
*/
cout<<d[n-1][W]<<endl;
return 0;
} | /tmp/cckmSxMK.o: in function `main':
a.cc:(.text+0x54): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0xc4): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0xd0): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0x19e): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckmSxMK.o
collect2: error: ld returned 1 exit status
|
s887146177 | p03732 | C++ | #define _GLIBCXX_DEBUG//TLEの原因になるので注意!!!!!!!!!!!
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long
//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある
ll d[101][1000000005];
ll w[105];
ll v[105];
int main(){
ll n,W;
cin >> n>>W;
ll l=0;
rep(i,n){
cin >> w[i]>>v[i];
//l=(w[0]+3)*(i+2);
if(i==0){
rep(j,w[0]){
d[0][j]=0;
}
reps(j,w[0],W){
d[0][j]=v[0];
}
}else{
rep(j,W+1){
if(j-w[i]>=0){
d[i][j]=max(d[i-1][j],d[i-1][j-w[i]]+v[i]);
}else{
d[i][j]=d[i-1][j];
}
}
}
}
rep(i,n){
rep(j,W+1){
cerr<<d[i][j]<<' ';
}
cerr<<endl;
}
cout<<d[n-1][W]<<endl;
return 0;
} | /tmp/ccIbkYMh.o: in function `main':
a.cc:(.text+0x54): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0xc4): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0xd0): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0x19e): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccIbkYMh.o
collect2: error: ld returned 1 exit status
|
s617136804 | p03732 | C++ | #define _GLIBCXX_DEBUG//TLEの原因になるので注意!!!!!!!!!!!
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long
//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある
ll d[101][1000000005];
ll w[105];
ll v[105];
int main(){
int n,W;
cin >> n>>W;
int l=0;
rep(i,n){
cin >> w[i]>>v[i];
//l=(w[0]+3)*(i+2);
if(i==0){
rep(j,w[0]){
d[0][j]=0;
}
reps(j,w[0],W){
d[0][j]=v[0];
}
}else{
rep(j,W+1){
if(j-w[i]>=0){
d[i][j]=max(d[i-1][j],d[i-1][j-w[i]]+v[i]);
}else{
d[i][j]=d[i-1][j];
}
}
}
}
rep(i,n){
rep(j,W+1){
cerr<<d[i][j]<<' ';
}
cerr<<endl;
}
cout<<d[n-1][W]<<endl;
return 0;
} | /tmp/ccaiFZBd.o: in function `main':
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0x7f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0xcf): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0x12b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0x15b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0x196): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccaiFZBd.o
collect2: error: ld returned 1 exit status
|
s559235572 | p03732 | C++ | #define _GLIBCXX_DEBUG//TLEの原因になるので注意!!!!!!!!!!!
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long
//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある
ll d[101][1000000005];
ll w[105];
ll v[105];
int main(){
int n,W;
cin >> n>>W;
int l=0;
rep(i,n){
cin >> w[i]>>v[i];
//l=(w[0]+3)*(i+2);
if(i==0){
rep(j,w[0]){
d[0][j]=0;
}
reps(j,w[0],W){
d[0][j]=v[0];
}
}else{
rep(j,W+1){
if(j-w[i]>=0){
d[i][j]=max(d[i-1][j],d[i-1][j-w[i]]+v[i]);
}else{
d[i][j]=d[i-1][j];
}
}
}
}
/*
rep(i,n){
rep(j,W){
cerr<<d[i][j]<<' ';
}
cerr<<endl;
}
*/
cout<<d[n-1][W]<<endl;
return 0;
} | /tmp/ccwnlfiD.o: in function `main':
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0x7f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0xcf): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0x12b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0x15b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0x196): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccwnlfiD.o
collect2: error: ld returned 1 exit status
|
s619789416 | p03732 | C++ | #define _GLIBCXX_DEBUG//TLEの原因になるので注意!!!!!!!!!!!
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long
//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある
ll d[101][1000000005];
ll w[105];
ll v[105];
int main(){
int n,W;
cin >> n>>W;
int l=0;
rep(i,n){
cin >> w[i]>>v[i];
//l=(w[0]+3)*(i+2);
if(i==0){
rep(j,w[0]){
d[0][j]=0;
}
reps(j,w[0],W){
d[0][j]=v[0];
}
}else{
rep(j,W+1){
if(j-w[i]>=0){
d[i][j]=max(d[i-1][j],d[i-1][j-w[i]]+v[i]);
}else{
d[i][j]=d[i-1][j];
}
}
}
}
rep(i,n){
rep(j,W){
cerr<<d[i][j]<<' ';
}
cerr<<endl;
}
cout<<d[n-1][W]<<endl;
return 0;
} | /tmp/ccrsXajT.o: in function `main':
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccrsXajT.o
a.cc:(.text+0x7f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccrsXajT.o
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccrsXajT.o
a.cc:(.text+0xcf): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccrsXajT.o
a.cc:(.text+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccrsXajT.o
a.cc:(.text+0x12b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccrsXajT.o
a.cc:(.text+0x15b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccrsXajT.o
a.cc:(.text+0x196): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccrsXajT.o
collect2: error: ld returned 1 exit status
|
s356438617 | p03732 | C++ | #define _GLIBCXX_DEBUG//TLEの原因になるので注意!!!!!!!!!!!
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long
//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある
ll d[101][1000000005];
ll w[105];
ll v[105];
int main(){
int n,W;
cin >> n>>W;
int l=0;
rep(i,n){
cin >> w[i]>>v[i];
//l=(w[0]+3)*(i+2);
if(i==0){
rep(j,w[0]){
d[0][j]=0;
}
reps(j,w[0],W){
d[0][j]=v[0];
}
}else{
rep(j,W+1){
if(j-w[i]>=0){
d[i][j]=max(d[i-1][j],d[i-1][j-w[i]]+v[i]);
}else{
d[i][j]=d[i-1][j];
}
}
}
}
rep(i,n){
rep(j,W){
cerr<<d[i][j]<<' ';
}
cerr<<endl;
}
cout<<d[n-1][W]<<endl;
return 0;
} | /tmp/ccd7C4UI.o: in function `main':
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccd7C4UI.o
a.cc:(.text+0x7f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccd7C4UI.o
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccd7C4UI.o
a.cc:(.text+0xcf): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccd7C4UI.o
a.cc:(.text+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccd7C4UI.o
a.cc:(.text+0x12b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccd7C4UI.o
a.cc:(.text+0x15b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccd7C4UI.o
a.cc:(.text+0x196): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccd7C4UI.o
collect2: error: ld returned 1 exit status
|
s868889609 | p03732 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.next());
int W = Integer.parseInt(sc.next());
ArrayList<Integer> val_1 = new ArrayList<Integer>();
ArrayList<Integer> val_2 = new ArrayList<Integer>();
ArrayList<Integer> val_3 = new ArrayList<Integer>();
ArrayList<Integer> val_4 = new ArrayList<Integer>();
int w1 = Integer.parseInt(sc.next());
int v1 = Integer.parseInt(sc.next());
val_1.add(v1);
for (int i=0;i<N-1;i++) {
int w = Integer.parseInt(sc.next());
int v = Integer.parseInt(sc.next());
if (w==w1) {
val_1.add(v);
} else if (w==w1+1) {
val_2.add(v);
} else if (w==w1+2) {
val_3.add(v);
} else { // w==w1+3
val_4.add(v);
}
}
Collections.sort(val_1, (o1, o2) -> Integer.compare(o2, o1));
Collections.sort(val_2, (o1, o2) -> Integer.compare(o2, o1));
Collections.sort(val_3, (o1, o2) -> Integer.compare(o2, o1));
Collections.sort(val_4, (o1, o2) -> Integer.compare(o2, o1));
// System.out.println(val_1);
// System.out.println(val_2);
// System.out.println(val_3);
// System.out.println(val_4);
long[] dp_1 = new long[val_1.size()+1];
long[] dp_2 = new long[val_2.size()+1];
long[] dp_3 = new long[val_3.size()+1];
long[] dp_4 = new long[val_4.size()+1];
for (int i=0;i<val_1.size();i++) {
dp_1[i+1] = dp_1[i]+(long)val_1.get(i);
}
for (int i=0;i<val_2.size();i++) {
dp_2[i+1] = dp_2[i]+(long)val_2.get(i);
}
for (int i=0;i<val_3.size();i++) {
dp_3[i+1] = dp_3[i]+(long)val_3.get(i);
}
for (int i=0;i<val_4.size();i++) {
dp_4[i+1] = dp_4[i]+(long)val_4.get(i);
}
long ans = 0L;
for (int i=0;i<=N;i++) {
for (int j=0;j<=N;j++) {
for (int k=0;k<=N;k++) {
for (int l=0;l<=N;l++) {
int l = Math.min(val_4.size(), N-i-j-k);
if (l<0) {
continue;
}
if (i>val_1.size() || j>val_2.size() || k>val_3.size() || l>val_4.size()) {
continue;
}
// System.out.println("a: " + ((long)w1*i+(long)(w1+1)*j+(long)(w1+2)*k+(long)(w1+3)*l));
if (((long)w1*i+(long)(w1+1L)*j+(long)(w1+2L)*k+(long)(w1+3L)*l)>(long)W) {
// System.out.println("aa");
continue;
}
ans = Math.max(ans, dp_1[i]+dp_2[j]+dp_3[k]+dp_4[l]);
}
}
}
}
System.out.println(ans);
}
} | Main.java:57: error: variable l is already defined in method main(String[])
int l = Math.min(val_4.size(), N-i-j-k);
^
1 error
|
s230054114 | p03732 | C++ | #include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
int main(){
ll n, w;
cin >> n >> w;
vector<vector<ll>> v(4);
ll w1, v1;
cin >> w1 >> v1;
v[0].push_back(v1);
rep(i, n-1){
ll x, y;
cin >> x >> y;
v[x-w1].push_back(y);
}
rep(i, 4)sort(v[i].rbegin(),v[i].rend()));
ll dp[4][101] = {};
rep(i, 4)rep(j, v[i].size())dp[i][j+1] = dp[i][j] + v[i][j];
int ans = 0;
rep(i,v[0].size()+1)rep(j,v[1].size()+1)rep(k,v[2].size()+1)rep(l,v[3].size()+1){
int weight = w1*i + (w1+1)*j + (w1+2)*k + (w1+3)*l;
if(weight > w) continue;
int res = dp[0][i] + dp[1][j] + dp[2][k] + dp[3][l];
ans = max(ans,res);
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:28:45: error: expected ';' before ')' token
28 | rep(i, 4)sort(v[i].rbegin(),v[i].rend()));
| ^
| ;
|
s038739388 | p03732 | C++ | #include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
using namespace std;
typedef long long int ll;
ll dp[101][100000001];
ll n, W;
vector<ll> v, w;
void solve()
{
for (ll i = n - 1; i >= 0; i--)
{
for (ll j = 0; j <= W; j++)
{
if (j < w[i])
{
dp[i][j] = dp[i + 1][j];
}
else
{
dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]);
}
}
}
cout << dp[0][W] << endl;
}
int main(int argc, char const *argv[])
{
cin >> n >> W;
for (ll i = 0; i < n; i++)
{
ll _w, _v;
cin >> _w >> _v;
w.push_back(_w);
v.push_back(_v);
}
solve();
} | /tmp/ccIrONfo.o: in function `solve()':
a.cc:(.text+0xc): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIrONfo.o
a.cc:(.text+0x34): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIrONfo.o
a.cc:(.text+0xb3): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIrONfo.o
a.cc:(.text+0xf0): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccIrONfo.o
a.cc:(.text+0x16d): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccIrONfo.o
a.cc:(.text+0x18e): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccIrONfo.o
/tmp/ccIrONfo.o: in function `main':
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIrONfo.o
a.cc:(.text+0x1fe): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccIrONfo.o
a.cc:(.text+0x249): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIrONfo.o
a.cc:(.text+0x25f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccIrONfo.o
a.cc:(.text+0x273): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s738857632 | p03732 | C++ | #include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
using namespace std;
typedef long long int ll;
ll dp[101][1000000001];
ll n, W;
vector<ll> v, w;
void solve()
{
for (ll i = n - 1; i >= 0; i--)
{
for (ll j = 0; j <= W; j++)
{
if (j < w[i])
{
dp[i][j] = dp[i + 1][j];
}
else
{
dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]);
}
}
}
cout << dp[0][W] << endl;
}
int main(int argc, char const *argv[])
{
cin >> n >> W;
for (ll i = 0; i < n; i++)
{
ll _w, _v;
cin >> _w >> _v;
w.push_back(_w);
v.push_back(_v);
}
solve();
} | /tmp/ccn3qSA8.o: in function `solve()':
a.cc:(.text+0xc): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccn3qSA8.o
a.cc:(.text+0x34): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccn3qSA8.o
a.cc:(.text+0xb3): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccn3qSA8.o
a.cc:(.text+0xf0): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccn3qSA8.o
a.cc:(.text+0x16d): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccn3qSA8.o
a.cc:(.text+0x18e): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccn3qSA8.o
/tmp/ccn3qSA8.o: in function `main':
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccn3qSA8.o
a.cc:(.text+0x1fe): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccn3qSA8.o
a.cc:(.text+0x249): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccn3qSA8.o
a.cc:(.text+0x25f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccn3qSA8.o
a.cc:(.text+0x273): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s394044710 | p03732 | C++ | #include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end(),greater<ll>())
#define ALL(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;
void Main(){
int N;
ll W;
cin>>N>>W;
ll w[N];
ll v[N];
rep(i,N){
cin>>w[i];
cin>>v[i];
}
vector<vector<ll>> se(4);
rep(i,N){
se[w[i]-w[0]].emplace_back(v[i]);
}
SORT(se[0]);
SORT(se[1]);
SORT(se[2]);
SORT(se[3]);
a
int ses[4];
rep(i,4){
ses[i]=se[i].size()+1;
}
ll ct=0;
rep(i,ses[0]){
rep(j,ses[1]){
rep(k,ses[2]){
rep(l,ses[3]){
ll weight=0;
ll value=0;
rep(x1,i){
weight+=w[0];
value+=se[0][x1];
}
rep(x2,j){
weight+=w[0]+1;
value+=se[1][x2];
}
rep(x3,k){
weight+=w[0]+2;
value+=se[2][x3];
}
rep(x4,l){
weight+=w[0]+3;
value+=se[3][x4];
}
if(weight<=W){
ct=max(ct,value);
}
}
}
}
}
cout<< ct<<"\n";
}
//-----------------------------------
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
}
//-----------------------------------
| a.cc: In function 'void Main()':
a.cc:41:1: error: 'a' was not declared in this scope
41 | a
| ^
a.cc:44:5: error: 'ses' was not declared in this scope; did you mean 'se'?
44 | ses[i]=se[i].size()+1;
| ^~~
| se
a.cc:49:9: error: 'ses' was not declared in this scope; did you mean 'se'?
49 | rep(i,ses[0]){
| ^~~
a.cc:5:38: note: in definition of macro 'rep'
5 | #define rep(i, n) for(int i = 0; i < n; i++)
| ^
|
s968188446 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
const int eps=1e-6;
const int inf=0x3f3f3f3f;
typedef unsigned long long ull;
typedef long long ll;
const int N = 110 ;
int n,m,a[110],b[110],dp[110][110][330];
int main()
{
cin<<n<<m;
for(int i=1;i<=n;i++)cin<<a[i]<<b[i];
for(int i=1;i<=n;i++)
for(int j=0;j<=i;j++)
for(int k=0;k<=3*j;k++)
{
dp[i+1][j][k]=max(dp[i+1][j][k],dp[i][j][k]);
dp[i+1][j+1][k+a[i]-a[1]]=max(dp[i+1][j+1][k+a[i]-a[1]],dp[i][j][k]+b[i]) ;
}
int ans=0 ;
for (int i=0;i<=n;i++)
for (int j=0;j<=3*i;j++){
ll W= (ll) a[1]*i+j;
if (W<=m) ans=max(ans,dp[n+1][i][j]) ;
}
printf("%d",ans) ;
return 0 ;
} | a.cc: In function 'int main()':
a.cc:11:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
11 | cin<<n<<m;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:11:9: note: candidate: 'operator<<(int, int)' (built-in)
11 | cin<<n<<m;
| ~~~^~~
a.cc:11: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++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)'
1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin<<n<<m;
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:11:6: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
11 | cin<<n<<m;
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin<<n<<m;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin<<n<<m;
| ^
/usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)'
1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin<<n<<m;
| ^
In file included from /usr/include/c++/14/bits/ios_base.h:46,
from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin<<n<<m;
| ^
In file included from /usr/include/c++/14/memory:80,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56:
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)'
70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin<<n<<m;
| ^
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin<<n<<m;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin<<n<<m;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin<<n<<m;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin<<n<<m;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin<<n<<m;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin<<n<<m;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
11 | cin<<n<<m;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:11:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
11 | cin<<n<<m;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> |
s500059548 | p03732 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<pair<int,int> > items;
int knapsack(int w)
{
vector<int> dp(w+4,0);
for(int i=0 ; i<items.size() ; ++i)
{
for(int j=w ; j>=items[i].first ; --j)
{
dp[j]=max(dp[j],dp[j-items[i].first]+items[i].second);
}
}
return dp[w];
}
int main()
{
int n,w;
cin>>n>>w;
for(int i=0 ; i<n ; ++i)
{
int x,y;
cin>>x>>y;
items.push_back({x,y});
}
cout<<knapsack(w,items)<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:28:19: error: too many arguments to function 'int knapsack(int)'
28 | cout<<knapsack(w,items)<<endl;
| ~~~~~~~~^~~~~~~~~
a.cc:5:5: note: declared here
5 | int knapsack(int w)
| ^~~~~~~~
|
s267439076 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
map<pair<int,int>,int>d;
int w[100],v[100],N,W;
int dp(int i,int j){
pair<int,int> p=make_pair(i,j);
if(d.count(p)) return d[p];
long res;
if(i==n)res=0;
else if(j<w[i])res=dp(i+1,j);
else res=max(dp(i+1,j),dp(i+1,j-w[i])+v[i]);
return d[p]=res;
}
int main(){
cin>>N>>W;
for(int i=0;i<N;i++)cin>>w[i]>>v[i];
cout<<dp(0,W)<<endl;
}
| a.cc: In function 'int dp(int, int)':
a.cc:9:15: error: 'n' was not declared in this scope
9 | if(i==n)res=0;
| ^
|
s547836399 | p03732 | C++ | #include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#define FOR(idx, begin, end) for(int idx = (int)(begin); idx < (int)(end); ++idx)
#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif
using namespace std;
typedef long long lint;
const int MOD = 1000000007, INF = 1111111111;
const double EPS = 1e-9;
struct itm { int w; int val; };
bool operator<(itm &lhs, itm &rhs) { return lhs.w < rhs.w; };
bool operator>(itm &lhs, itm &rhs) { return lhs.val > rhs.val; };
int main() {
cin.tie(0);
int N, W;
cin >> N >> W;
vector<itm> item(N);
FOR(i, 0, N) cin >> item[i].w >> item[i].val;
int w0 = item[0].w;
sort(item.begin(), item.end());
vector<vector<itm>> numw(4);
for (const auto &ele : item) {
FOR(i, 0, 4) if (ele.w == w0 + i) numw[i].emplace_back(ele);
}
itm zero;
zero.w = 0; zero.val = 0;
FOR(i, 0, 4) numw[i].emplace_back(zero);
FOR(i, 0, 4) sort(numw[i].begin(), numw[i].end(),operator>);
DMP(numw[0].size());
lint ans = 0, tmp = 0;
FOR(i0, 0, numw[0].size())FOR(i1, 0, numw[1].size())FOR(i2, 0, numw[2].size())FOR(i3, 0, numw[3].size()) {
tmp = 0;
DMP((i0 + i1 + i2 + i3)*w0 + i1 + 2 * i2 + 3 * i3);
if ((i0 + i1 + i2 + i3)*w0 + i1 + 2 * i2 + 3 * i3 <= W) {
FOR(ii0, 0, i0) tmp += numw[0][ii0].val;
FOR(ii1, 0, i1) tmp += numw[1][ii1].val;
FOR(ii2, 0, i2) tmp += numw[2][ii2].val;
FOR(ii3, 0, i3) tmp += numw[3][ii3].val;
ans = ans < tmp ? tmp : ans;
}
}
cout << ans;
return 0;
} | a.cc: In function 'int main()':
a.cc:50:26: error: no matching function for call to 'sort(std::vector<itm>::iterator, std::vector<itm>::iterator, <unresolved overloaded function type>)'
50 | FOR(i, 0, 4) sort(numw[i].begin(), numw[i].end(),operator>);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: template argument deduction/substitution failed:
a.cc:50:26: note: couldn't deduce template parameter '_Compare'
50 | FOR(i, 0, 4) sort(numw[i].begin(), numw[i].end(),operator>);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 3 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15:
/usr/include/c++/14/pstl/execution_defs.h: In substitution of 'template<class _ExecPolicy, class _Tp> using __pstl::__internal::__enable_if_execution_policy = typename std::enable_if<__pstl::execution::v1::is_execution_policy<typename std::remove_cv<typename std::remove_reference<_Tp>::type>::type>::value, _Tp>::type [with _ExecPolicy = __gnu_cxx::__normal_iterator<itm*, std::vector<itm> >; _Tp = void]':
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: required by substitution of 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator) [with _ExecutionPolicy = __gnu_cxx::__normal_iterator<itm*, std::vector<itm> >; _RandomAccessIterator = __gnu_cxx::__normal_iterator<itm*, std::vector<itm> >]'
a.cc:50:19: required from here
50 | FOR(i, 0, 4) sort(numw[i].begin(), numw[i].end(),operator>);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/execution_defs.h:82:7: error: no type named 'type' in 'struct std::enable_if<false, void>'
82 | using __enable_if_execution_policy =
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s875780815 | p03732 | C++ | from collections import *
N,W=map(int,input().split())
d=defaultdict(int)
d[0]=0
for i in range(N):
v,w=map(int,input().split())
c=d.copy()
for p,q in c.items():
if p+w<=W:
d[p+w]=max(d[p+w],q+v)
print(max(d.values())) | a.cc:1:1: error: 'from' does not name a type
1 | from collections import *
| ^~~~
|
s118771811 | p03732 | C++ | #include <stdio.h>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main() {
int N,W;
cin >> N >> W;
vector<pair<int,int>> wv(N);
for (int i=0; i<N; i++) {
cin >> wv[i].first >> wv[i].second;
}
int smallw = wv[0].first;
//cerr << smallw << endl;
sort(wv.begin(),wv.end());
/*for (int i=0; i<N; i++) {
cerr << wv[i].first << " " << wv[i].second << endl;
}*/
int cc0 = 0;
int cc1 = 0;
int cc2 = 0;
int cc3 = 0;
for (int i=0; i<N; i++) {
if (wv[i].first == smallw) {
cc0++;
continue;
}
if (wv[i].first == smallw+1) {
cc1++;
continue;
}
if (wv[i].first == smallw+2) {
cc2++;
continue;
}
cc3++;
}
vector<long> vv0(cc0+1,0);
vector<long> vv1(cc1+1,0);
vector<long> vv2(cc2+1,0);
vector<long> vv3(cc3+1,0);
for (int i=cc0-1; i>=0; i--) {
vv0[cc0-i] = vv0[cc0-1-i] + wv[i].second;
cerr << vv0[cc0-i] << ' ';
}
cerr << endl;
for (int i=cc1-1; i>=0; i--) {
vv1[cc1-i] = vv1[cc1-1-i] + wv[i+cc0].second;
cerr << vv1[cc1-i] << ' ';
}
cerr << endl;
for (int i=cc2-1; i>=0; i--) {
vv2[cc2-i] = vv2[cc2-1-i] + wv[i+cc0+cc1].second;
cerr << vv2[cc2-i] << ' ';
}
cerr << endl;
for (int i=cc3-1; i>=0; i--) {
vv3[cc3-i] = vv3[cc3-1-i] + wv[i+cc0+cc1+cc2].second;
cerr << vv3[cc3-i] << ' ';
}
cerr << endl;
long ans = 0;
long term = 0;
for(int i=0; i<cc0+1; i++) {
for(int j=0; j<cc1+1; j++) {
for(int k=0; k<cc2+1; k++) {
for(int l=0; l<cc3+1; l++) {
if ((i+j+k+l)*smallw+j+k*2+l*3 > W) {
continue;
}
term = vv0[i] + vv1[j] + vv2[k] + vv3[l];
ans = max(term,ans);
term = 0;
}
}
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
9 | cin >> N >> W;
| ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
4 | #include <map>
+++ |+#include <iostream>
5 | using namespace std;
a.cc:49:5: error: 'cerr' was not declared in this scope
49 | cerr << vv0[cc0-i] << ' ';
| ^~~~
a.cc:49:5: note: 'std::cerr' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:51:3: error: 'cerr' was not declared in this scope
51 | cerr << endl;
| ^~~~
a.cc:51:3: note: 'std::cerr' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:51:11: error: 'endl' was not declared in this scope
51 | cerr << endl;
| ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
4 | #include <map>
+++ |+#include <ostream>
5 | using namespace std;
a.cc:83:3: error: 'cout' was not declared in this scope
83 | cout << ans << endl;
| ^~~~
a.cc:83:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s741492448 | p03732 | C++ | #include <bits/stdc++.h>
using namespace std;
void Sort(int*, int*, int)
int main() {
int n,w;
cin >> n >> w;
int a[n],b[n];
for(int i=0;i<n;i++) {
cin >> a[i] >> b[i];
}
Sort(a,b,n);
int sum = 0;
for(int i=0;i<n;i++) {
if(w >= a[i]) {
w -= a[i];
sum += b[i];
}
}
cout << sum << endl;
}
void Sort(int* a, int* b, int size) {
for(int i=0;i<size;i++) {
for(int j=i+1;j<size;j++) {
if(b[i]<b[j]) {
int num1 = a[i];
a[i] = a[j];
a[j] = num1;
int num2 = b[i];
b[i] = b[j];
b[j] = num2;
}
}
}
}
| a.cc:6:1: error: expected initializer before 'int'
6 | int main() {
| ^~~
|
s875156357 | p03732 | C++ | #include <bits/stdc++.h>
using namespace std;
void Sort(int*, int*, int)
int main() {
int n,w;
cin >> n >> w;
int a[n],b[n]
for(int i=0;i<n;i++) {
cin >> a[i] >> b[i];
}
Sort(a,b,n);
int sum = 0;
for(int i=0;i<n;i++) {
if(w >= a[i]) {
w -= a[i];
sum += b[i];
}
}
cout << sum << endl;
}
void Sort(int* a, int* b, int size) {
for(int i=0;i<size;i++) {
for(int j=i+1;j<size;j++) {
if(b[i]<b[j]) {
int num1 = a[i];
a[i] = a[j];
a[j] = num1;
int num2 = b[i];
b[i] = b[j];
b[j] = num2;
}
}
}
}
| a.cc:6:1: error: expected initializer before 'int'
6 | int main() {
| ^~~
|
s356618662 | p03732 | C++ | #include <iostream>
#include <climits>
#include <algorithm>
using namespace std;
// 入力
int n, W;
int weight[1000000010], value[110];
// DPテーブル
int dp[110][10010];
int main() {
cin >> n >> W;
for (int i = 0; i < n; ++i) cin >> value[i] >> weight[i];
// DP初期条件: dp[0][w] = 0
for (int w = 0; w <= W; ++w) dp[0][w] = 0;
// DPループ
for (int i = 0; i < n; ++i) {
for (int w = 0; w <= W; ++w) {
if (w >= weight[i]) dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w]);
else dp[i+1][w] = dp[i][w];
}
}
cout << dp[n][W] << endl;
} | /tmp/cc9hKyX1.o: in function `main':
a.cc:(.text+0x4f): relocation truncated to fit: R_X86_64_PC32 against symbol `value' defined in .bss section in /tmp/cc9hKyX1.o
a.cc:(.text+0xb5): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc9hKyX1.o
a.cc:(.text+0x127): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc9hKyX1.o
a.cc:(.text+0x168): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc9hKyX1.o
a.cc:(.text+0x17f): relocation truncated to fit: R_X86_64_PC32 against symbol `value' defined in .bss section in /tmp/cc9hKyX1.o
a.cc:(.text+0x1c0): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc9hKyX1.o
a.cc:(.text+0x1ef): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc9hKyX1.o
a.cc:(.text+0x214): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc9hKyX1.o
a.cc:(.text+0x267): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc9hKyX1.o
collect2: error: ld returned 1 exit status
|
s291157293 | p03732 | C++ | #include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long LL;
const int INF=1<<30;
const LL MOD=1000000007;
LL gcd(LL a,LL b){
if(b==0)return a;
return gcd(b,a%b);
}
int main(){
int n,w;
cin>>n>>w;
vector<LL> v[4];
int w1;
for(int i=0;i<n;++i){
int w2,v;
cin>>w2>>v;
if(i==0)w1=w2;
v[w2-w1].push_back(v);
}
for(int i=0;i<4;++i){
sort(v[i].begin(),v[i].end());
v[i].push_back(0);
reverse(v[i].begin(),v[i].end());
for(int j=1;j<v[i].size();++j){
v[i][j]+=v[i][j-1];
}
}
LL ans=0;
for(int i=0;i<v[0].size();++i){
for(int j=0;j<v[1].size();++j){
for(int k=0;k<v[2].size();++k){
for(int l=0;l<v[3].size();++l){
if(w>= (i*w1+j*(w1+1)+k*(w1+2)+l*(w1+3))){
ans=max(ans,(v[0][i]+v[1][j]+v[2][k]+v[3][l]));
}
}
}
}
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:36:10: error: invalid types 'int[int]' for array subscript
36 | v[w2-w1].push_back(v);
| ^
|
s576750078 | p03732 | C++ | #include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
int main(int argc, const char * argv[]) {
ll N, W;
cin >> N >> W;
vector<ll> v1, v2, v3, v4;
ll w1 = 0;
for (int i = 0; i < N; i++) {
ll wi, vi;
cin >> wi >> vi;
if (i == 0) {
w1 = wi;
}
if (wi == w1 + 0) {
v1.push_back(vi);
}
if (wi == w1 + 1) {
v2.push_back(vi);
}
if (wi == w1 + 2) {
v3.push_back(vi);
}
if (wi == w1 + 3) {
v4.push_back(vi);
}
}
sort(v1.begin(), v1.end(), greater<ll>());
sort(v2.begin(), v2.end(), greater<ll>());
sort(v3.begin(), v3.end(), greater<ll>());
sort(v4.begin(), v4.end(), greater<ll>());
int l1, l2, l3, l4;
l1 = v1.size();
l2 = v2.size();
l3 = v3.size();
l4 = v4.size();
ll a1[l1 + 1];
ll a2[l2 + 1];
ll a3[l3 + 1];
ll a4[l4 + 1];
memset(a1, 0, sizeof(a1));
memset(a2, 0, sizeof(a2));
memset(a3, 0, sizeof(a3));
memset(a4, 0, sizeof(a4));
a1[1] = (l1 > 0) ? v1[0] : 0;
a2[1] = (l2 > 0) ? v2[0] : 0;
a3[1] = (l3 > 0) ? v3[0] : 0;
a4[1] = (l4 > 0) ? v4[0] : 0;
for (int i = 2; i < l1 + 1; i++) {
a1[i] += (v1[i - 1] + a1[i - 1]);
}
for (int i = 2; i < l2 + 1; i++) {
a2[i] += (v2[i - 1] + a2[i - 1]);
}
for (int i = 2; i < l3 + 1; i++) {
a3[i] += (v3[i - 1] + a3[i - 1]);
}
for (int i = 2; i < l4 + 1; i++) {
a4[i] += (v4[i - 1] + a4[i - 1]);
}
ll maxv= 0;
for (int i1 = 0; i1 < l1 + 1; i1++) {
for (int i2 = 0; i2 < l2 + 1; i2++) {
for (int i3 = 0; i3 < l3 + 1; i3++) {
for (int i4 = 0; i4 < l4 + 1; i4++) {
ll w = w1 * i1 + (w1 + 1) * i2 + (w1 + 2) * i3 + (w1 + 3) * i4;
if (w > W) {
continue;
}
ll v = a1[i1] + a2[i2] + a3[i3] + a4[i4];
maxv = max(maxv, v);
}
}
}
}
cout << maxv << endl;
return 0;
}
| a.cc: In function 'int main(int, const char**)':
a.cc:51:3: error: 'memset' was not declared in this scope
51 | memset(a1, 0, sizeof(a1));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <algorithm>
+++ |+#include <cstring>
6 |
|
s373013681 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,m,a[111],b[111],f[111][111][310];
int main()
{
cin>>n>>m;
for (int i=0;i<n;i++)
cin>>a[i]>>b[i];
for (int i=0;i<n;i++)
for (int j=0;j<=i;j++)
for (int k=0;k<=3*j;k++)
{
f[i+1][j][k]=max(f[i+1][j][k],f[i][j][k]);
f[i+1][j+1][k+a[i]-a[0]]=max(f[i+1][j+1][k+a[i]-a[0]],f[i][j][k]+b[i]);
}
int ans=0;
for (int i=0;i<=n;i++)
for (int j=0;j<=3*i;j++)
{
long long W=(long long)a[0]*i+j;
if (W<=m) ans=max(ans,f[n][i][j]);
}
cout<<ans;
return 0;
}
} | a.cc:27:1: error: expected declaration before '}' token
27 | }
| ^
|
s828076526 | p03732 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, w;
cin >> n >> w;
vector<vector<int>> a(4);
int sw;
for(int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
if(i == 0) sw = x;
a[x -sw].push_back(y);
}
for(int i = 0; i < 4; i++) {
sort(a[i].rbegin(), a[i].rend());
}
long long ans = 0;
for(int i = 0; i <= a[0].size(); i++) {
for(int j = 0; j <= a[1].size(); j++) {
for(int k = 0; k <= a[2].size(); k++) {
for(int l = 0; l <= a[3].size(); l++) {
long long val = 0;
long long ww = 1LL * i * sw + 1LL * j * (ws + 1) + 1LL * k * (ws + 2) + 1LL * l * (ws + 3);
if(ww > w) continue;
for(int m = 0; m < i; m++) {
val += a[0][m];
}
for(int m = 0; m < j; m++) {
val += a[1][m];
}
for(int m = 0; m < k; m++) {
val += a[2][m];
}
for(int m = 0; m < l; m++) {
val += a[3][m];
}
ans = max(val, ans);
}
}
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:27:85: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
27 | long long ww = 1LL * i * sw + 1LL * j * (ws + 1) + 1LL * k * (ws + 2) + 1LL * l * (ws + 3);
| ~~~^~~
a.cc:27:106: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
27 | long long ww = 1LL * i * sw + 1LL * j * (ws + 1) + 1LL * k * (ws + 2) + 1LL * l * (ws + 3);
| ~~~^~~
a.cc:27:127: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
27 | long long ww = 1LL * i * sw + 1LL * j * (ws + 1) + 1LL * k * (ws + 2) + 1LL * l * (ws + 3);
| ~~~^~~
|
s724912975 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N, W;
cin >> N >> W;
vector<int> V[4];
ll w1;
rep(i, N) {
int w, v;
cin >> w >> v;
if (i == 0) w1 = w;
V[w - w1].pb(v);
}
rep(i, 4) {
sort(V[i].begin(), V[i].end());
reverse(V[i].begin(), V[i].end());
}
int V0 = V[0].size();
int V1 = V[1].size();
int V2 = V[2].size();
int V3 = V[3].size();
ll saidai = 0;
rep(i, V0 + 1) {
rep(ii, V1 + 1) {
rep(iii, V2 + 1) {
ll omosa = 0;
omosa += w1 * i;
omosa += (w1 + 1) * ii;
omosa += (w1 + 2) * iii;
if (omosa <= W) {
ll iiii = (W - omosa) / (w1 + 3);
iiii = min(iiii, V3);
ll kari = 0;
rep(j, i) kari += V[0][j];
rep(j, ii) kari += V[1][j];
rep(j, iii) kari += V[2][j];
rep(j, iiii) kari += V[3][j];
saidai = max(saidai, kari);
}
}
}
}
co(saidai);
Would you please return 0;
} | a.cc: In function 'int main()':
a.cc:54:51: error: no matching function for call to 'min(ll&, int&)'
54 | iiii = min(iiii, V3);
| ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:54:51: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
54 | iiii = min(iiii, V3);
| ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:54:51: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
54 | iiii = min(iiii, V3);
| ~~~^~~~~~~~~~
|
s769030779 | p03732 | C++ | #include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.1415926535897932384626;
long long int mod = 1000000007;
vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(15)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl
ll rui(ll abc,ll bed){
//abcのbed乗を計算する
if(bed==0){return 1;}
else{
ll ced = rui(abc,bed/2);
ced *= ced;
ced %= mod;
if(bed%2==1){ced*=abc; ced%=mod;}
return ced;
}
}
ll gcd(ll number1,ll number2){
if(number1 > number2){
swap(number1,number2);
}
if(number1 == 0 || number1 == number2){
return number2;
}else{
return gcd(number2 % number1,number1);
}
}
ll i,j,k,ii,jj;
ll n,m,num,ans;
ll a,b,c,d,e,g,h,r,bag;
ll wn1,wn2,wn3,wn4;
ll w[5005],v[5005];
ll dp[5][5005];
ll index[5];
int main(){
cin >> n >> bag;
for(i=0;i<n;i++){
cin >> w[i] >> v[i];
}
for(i=0;i<=3;i++){
index[i] = 1;
}
for(i=0;i<n;i++){
for(num = 0;num <= 3;num ++){
if(w[i] == w[0] + num){
dp[num][index[num]++] = v[i];
}
}
}
for(num=0;num<=3;num++){
sort(dp[num] + 1,dp[num] + index[num] + 1);
reverse(dp[num] + 1,dp[num] + index[num] + 1);
}
for(i=0;i<=3;i++){
for(j=1;j<=index[i];j++){
dp[i][j] += dp[i][j-1];
//pe(dp[i][j]);
}
//el;
}
for(int num1=0;num1 <= index[0];num1 ++){
for(int num2=0;num2 <= index[1];num2 ++){
for(int num3=0;num3 <= index[2];num3++){
if((bag-w[0]*num1-w[0]*num2-num2-w[0]*num3-2*num3) < 0)continue;
ll kosuu = (bag-w[0]*num1-w[0]*num2-num2-w[0]*num3-2*num3) / (w[0] + 3);
ll kati = dp[0][num1] + dp[1][num2] + dp[2][num3] + dp[3][kosuu];
ans = max(ans,kati);
}
}
}
p(ans);
return 0;
} | a.cc:82:11: error: 'll index [5]' redeclared as different kind of entity
82 | ll index[5];
| ^
In file included from /usr/include/string.h:462,
from a.cc:16:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'int main()':
a.cc:90:22: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
90 | index[i] = 1;
| ^
a.cc:95:46: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
95 | dp[num][index[num]++] = v[i];
| ^
a.cc:100:49: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
100 | sort(dp[num] + 1,dp[num] + index[num] + 1);
| ^
a.cc:101:52: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
101 | reverse(dp[num] + 1,dp[num] + index[num] + 1);
| ^
a.cc:104:33: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
104 | for(j=1;j<=index[i];j++){
| ^
a.cc:110:37: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
110 | for(int num1=0;num1 <= index[0];num1 ++){
| ^
a.cc:111:45: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
111 | for(int num2=0;num2 <= index[1];num2 ++){
| ^
a.cc:112:53: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
112 | for(int num3=0;num3 <= index[2];num3++){
| ^
|
s216600807 | p03732 | Java | import java.util.*;
class Main
{
public static void main (String[] args)
{
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int W = sc.nextInt();
int[] w = new int[N];
int[] v = new int[N];
for(int i = 0; i < N; i++){
w[i] = sc.nextInt();
v[i] = sc.nextInt();
}
int[][] dp = new int[W+1][N];
Arrays.fill(dp[0], 0);
for(int j = 1; j < W; j++){
dp[j][0] = (w[0] > j) ? 0 : v[0];
}
dp[0][0] = (w[0] > 1)? 0 : v[0];
for(int i = 1; i < W+1; i++){
for(int j = 1; j < N; j++){
long x = (i-w[j] >= 0) ? dp[i-w[j]][j-1] + v[j] : dp[0][j-1];
dp[i][j] = Math.max(dp[i][j-1], x);
}
}
System.out.println(dp[W][N-1]);
}
} | Main.java:27: error: incompatible types: possible lossy conversion from long to int
dp[i][j] = Math.max(dp[i][j-1], x);
^
1 error
|
s950217060 | p03732 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long int n,W;cin>>n>>W;
long long int w[n],v[n];
for(long long int i=0;i<n;i++) cin>>w[i]>>v[i];
int box[n+1][W+1];
for(long long int i=0;i<=n;i++){
for(long long int j=0;j<=W;j++){
box[i][j]=-1;
}
}
long long int ret=0;
box[0][0]=0;
for(long long int i=0;i<n;i++){
for(long long int j=0;j<=W;j++){
if(box[i][j]>=0){
box[i+1][j]=max(box[i][j],box[i+1][j]);
if(j+w[i]<=W){
box[i+1][j+w[i]]=max(box[i+1][j+w[i]],box[i][j]+v[i]);
ret=max(box[i+1][j+w[i]],ret);
}
}
}
}
cout<<ret<<endl;
}
| a.cc: In function 'int main()':
a.cc:20:31: error: no matching function for call to 'max(int&, long long int)'
20 | box[i+1][j+w[i]]=max(box[i+1][j+w[i]],box[i][j]+v[i]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:20:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
20 | box[i+1][j+w[i]]=max(box[i+1][j+w[i]],box[i][j]+v[i]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:20:31: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
20 | box[i+1][j+w[i]]=max(box[i+1][j+w[i]],box[i][j]+v[i]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:21:18: error: no matching function for call to 'max(int&, long long int&)'
21 | ret=max(box[i+1][j+w[i]],ret);
| ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
21 | ret=max(box[i+1][j+w[i]],ret);
| ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
21 | ret=max(box[i+1][j+w[i]],ret);
| ~~~^~~~~~~~~~~~~~~~~~~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.