제출 #303364

#제출 시각아이디문제언어결과실행 시간메모리
303364vipghn2003Stove (JOI18_stove)C++14
0 / 100
1 ms384 KiB
#include<bits/stdc++.h> #define int long long using namespace std; main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,k; cin>>n>>k; k--; vector<int>a(n); priority_queue<int>pq; for(int i=0;i<n;i++) { cin>>a[i]; if(i) pq.push(a[i]-1-a[i-1]); } int res=a[n-1]; while(k--) { res-=pq.top(); pq.pop(); } cout<<res; }

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

stove.cpp:5:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...