Submission #49483

# Submission time Handle Problem Language Result Execution time Memory
49483 2018-05-29T14:36:18 Z okaybody10 Stove (JOI18_stove) C++11
100 / 100
60 ms 10144 KB
#include <bits/stdc++.h>
using namespace std;
priority_queue<int> pq;

int main()
{
    int N,K,past,now; scanf("%d %d %d",&N,&K,&now);
    for(int i=1;i<N;i++)
    {
        past=now;
        scanf("%d",&now);
        pq.push(-(now-past-1));
    }
    int ans=N;
    for(int i=0;i<N-K;i++)
    {
        ans-=pq.top();
        pq.pop();
    }
    return !printf("%d\n",ans);
}

Compilation message

stove.cpp: In function 'int main()':
stove.cpp:7:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N,K,past,now; scanf("%d %d %d",&N,&K,&now);
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
stove.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&now);
         ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 3 ms 492 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Correct 2 ms 580 KB Output is correct
7 Correct 2 ms 580 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 3 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 3 ms 492 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Correct 2 ms 580 KB Output is correct
7 Correct 2 ms 580 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 3 ms 632 KB Output is correct
10 Correct 4 ms 660 KB Output is correct
11 Correct 4 ms 816 KB Output is correct
12 Correct 3 ms 832 KB Output is correct
13 Correct 3 ms 880 KB Output is correct
14 Correct 3 ms 932 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 3 ms 492 KB Output is correct
5 Correct 2 ms 528 KB Output is correct
6 Correct 2 ms 580 KB Output is correct
7 Correct 2 ms 580 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 3 ms 632 KB Output is correct
10 Correct 4 ms 660 KB Output is correct
11 Correct 4 ms 816 KB Output is correct
12 Correct 3 ms 832 KB Output is correct
13 Correct 3 ms 880 KB Output is correct
14 Correct 3 ms 932 KB Output is correct
15 Correct 3 ms 980 KB Output is correct
16 Correct 41 ms 2416 KB Output is correct
17 Correct 60 ms 3380 KB Output is correct
18 Correct 39 ms 4344 KB Output is correct
19 Correct 37 ms 5432 KB Output is correct
20 Correct 32 ms 6400 KB Output is correct
21 Correct 27 ms 7316 KB Output is correct
22 Correct 26 ms 8216 KB Output is correct
23 Correct 26 ms 9180 KB Output is correct
24 Correct 27 ms 10144 KB Output is correct