제출 #1350929

#제출 시각아이디문제언어결과실행 시간메모리
1350929prikpaoCloud Computing (CEOI18_clo)C++20
72 / 100
548 ms2200 KiB
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#define pii pair<int, int>
#define t3 tuple<int, int, int>
#define pepperX ios_base::sync_with_stdio(false); cin.tie(0);
using ll = long long;
using namespace std;
#define int ll

struct A{
    int core, rate, value;
    bool operator<(const A& o)const{
        return rate>o.rate;
    }
};

vector<A> v;

void solve(){
    int n, m;
    cin >> n;
    for(int i=1; i<=n; i++){
        int c, r, p;
        cin >> c >> r >> p;
        v.push_back({c, r, -p});
    }
    cin >> m;
    for(int i=1; i<=m; i++){
        int c, r, p;
        cin >> c >> r >> p;
        v.push_back({-c, r, p});
    }
    sort(v.begin(), v.end());
    vector<int> pre(100005, -1e18), now(100005);
    pre[0]=0;
    for(auto [c,r,p]:v){
        for(int j=0; j<=1e5; j++){
            if(0<=j-c && j-c<=1e5 && pre[j-c]!=-1e18)now[j]=max(pre[j], pre[j-c]+p);
            else now[j]=pre[j];
        }
        pre=now;
    }
    cout << *max_element(pre.begin(), pre.end());
}

int32_t main(){
    pepperX;
    int tcs=1;
    //cin >> tcs;
    while(tcs--) solve();
    return 0;
}

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

In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from clo.cpp:1:
In static member function 'static constexpr _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = long long int; _Up = long long int; bool _IsMove = false]',
    inlined from 'constexpr _OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = long long int*; _OI = long long int*]' at /usr/include/c++/13/bits/stl_algobase.h:506:30,
    inlined from 'constexpr _OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = long long int*; _OI = long long int*]' at /usr/include/c++/13/bits/stl_algobase.h:533:42,
    inlined from 'constexpr _OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = long long int*; _OI = long long int*]' at /usr/include/c++/13/bits/stl_algobase.h:540:31,
    inlined from 'constexpr _OI std::copy(_II, _II, _OI) [with _II = long long int*; _OI = long long int*]' at /usr/include/c++/13/bits/stl_algobase.h:633:7,
    inlined from 'static _ForwardIterator std::__uninitialized_copy<true>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = long long int*; _ForwardIterator = long long int*]' at /usr/include/c++/13/bits/stl_uninitialized.h:147:27,
    inlined from '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = long long int*; _ForwardIterator = long long int*]' at /usr/include/c++/13/bits/stl_uninitialized.h:185:15,
    inlined from 'constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, allocator<_Tp>&) [with _InputIterator = long long int*; _ForwardIterator = long long int*; _Tp = long long int]' at /usr/include/c++/13/bits/stl_uninitialized.h:373:37,
    inlined from 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' at /usr/include/c++/13/bits/vector.tcc:257:35,
    inlined from 'void solve()' at clo.cpp:41:13:
/usr/include/c++/13/bits/stl_algobase.h:437:30: warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' writing between 9 and 800040 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  437 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/c++allocator.h:33,
                 from /usr/include/c++/13/bits/allocator.h:46,
                 from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52:
In member function '_Tp* std::__new_allocator<_Tp>::allocate(size_type, const void*) [with _Tp = long long int]',
    inlined from 'constexpr _Tp* std::allocator< <template-parameter-1-1> >::allocate(std::size_t) [with _Tp = long long int]' at /usr/include/c++/13/bits/allocator.h:198:40,
    inlined from 'static constexpr _Tp* std::allocator_traits<std::allocator<_CharT> >::allocate(allocator_type&, size_type) [with _Tp = long long int]' at /usr/include/c++/13/bits/alloc_traits.h:482:28,
    inlined from 'constexpr std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' at /usr/include/c++/13/bits/stl_vector.h:381:33,
    inlined from 'constexpr std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' at /usr/include/c++/13/bits/stl_vector.h:378:7,
    inlined from 'constexpr void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' at /usr/include/c++/13/bits/stl_vector.h:398:44,
    inlined from 'constexpr std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' at /usr/include/c++/13/bits/stl_vector.h:335:26,
    inlined from 'constexpr std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]' at /usr/include/c++/13/bits/stl_vector.h:571:47,
    inlined from 'void solve()' at clo.cpp:34:34:
/usr/include/c++/13/bits/new_allocator.h:151:55: note: at offset 800040 into destination object of size 800040 allocated by 'operator new'
  151 |         return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp)));
      |                                                       ^
/usr/include/c++/13/bits/new_allocator.h:151:55: note: at offset 800040 into destination object of size 800040 allocated by 'operator new'
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...