Submission #159331


Source Code Expand

Copy
#include <deque>
#include <algorithm>
#include <iostream>

struct a{
    int now;
    int up;
    
    bool operator < (a pr){
        return this->now<pr.now;
    }
    
};


int main(){
    int k,n;
    int cost = 0;
    std::cin    >> k >> n;
    std::deque<a> nlist;
    nlist.clear();
    
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        a dis;
        std::cin    >> dis.now >>dis.up;
        
        nlist.push_back(dis);
    }
    
    for (int i = 0; i <k; i++) {
        

    std::sort(nlist.begin(), nlist.end());
    
    std::deque<a>::iterator pl = nlist.begin();
    cost += pl->now;
    
    pl->now+=pl->up;
    }
    
    
    
    return 0;
}

Submission Info

Submission Time
Task C - 増築王高橋君
User tacchannet
Language C++ (G++ 4.6.4)
Score 0
Code Size 720 Byte
Status CE

Compile Error

In file included from /usr/include/c++/4.6/algorithm:63:0,
                 from ./Main.cpp:2:
/usr/include/c++/4.6/bits/stl_algo.h: In function ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&) [with _RandomAccessIterator = std::_Deque_iterator<a, a&, a*>, _Tp = a]’:
/usr/include/c++/4.6/bits/stl_algo.h:2254:70:   instantiated from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = std::_Deque_iterator<a, a&, a*>]’
/usr/include/c++/4.6/bits/stl_algo.h:2285:54:   instantiated from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = std::_Deque_iterator<a, a&, a*>, _Size = long int]’
/usr/include/c++/4.6/bits/stl_algo.h:5408:4:   instantiated from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = std::_Deque_iterator<a, a&, a*>]’
./Main.cpp:34:41:   instantiated from here
/usr/include/c++/4.6/bits/st...