[Offer收割]编程练习赛1 register

Ended

Participants:955

Verdict:Time Limit Exceeded
Score:50 / 100
Submitted:2016-03-06 15:41:33

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<unordered_map>
#include<unordered_set>
#include<algorithm>
#include<math.h>
using namespace std;
int main(void)
{
    int N;
    long long Q;
    cin>>N>>Q;
    vector<int> p(N,0);
    for(int i=0;i<N;i++)
        cin>>p[i];
    int K=1;
    while(K<=N)
    {
        long long res=0;
        vector<int> h;
        for(int i=0;i<K;i++)
            h.push_back(p[i]);
        make_heap(h.begin(),h.end());
        pop_heap(h.begin(),h.end());
        res+=h[h.size()-1];
        h.pop_back();
        int count=1;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX