답안 #810854

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
810854 2023-08-06T16:45:37 Z mdacode Stove (JOI18_stove) C++14
0 / 100
1 ms 304 KB
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include<algorithm>
using namespace std;


int main(){
   int nbi,k;
   cin >> nbi >> k;
   vector<int>dif;
   int firv,fir,sec,tot=0;
   cin >> fir;
   firv=fir;
   for(int i=0;i<nbi-1;i++){
       cin >> sec;
       dif.push_back(sec-(fir+1));
       fir=sec;
   }
   sort(dif.begin(),dif.end());
   int res=(sec+1)-firv;
   for(int j=nbi-2;j>=nbi-k;j--){
       res-=dif[j];
   }
   cout << res;
}

Compilation message

stove.cpp: In function 'int main()':
stove.cpp:14:21: warning: unused variable 'tot' [-Wunused-variable]
   14 |    int firv,fir,sec,tot=0;
      |                     ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 304 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 304 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 304 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Halted 0 ms 0 KB -