제출 #66719

#제출 시각아이디문제언어결과실행 시간메모리
66719yusufakeStove (JOI18_stove)C++98
100 / 100
57 ms10656 KiB
#include<bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define st first #define nd second typedef long long ll; typedef pair < int , int > pp; const int mod = 1e9 + 7; const int N = 3e5 + 5; priority_queue < int > Q; int A[N],n,k,i,ans; int main(){ scanf("%d%d",&n,&k); for(i=1;i<=n;i++) scanf("%d",&A[i]); sort(A+1 , A+n+1); ans = A[n] - A[1] + 1; for(i=2;i<=n;i++) Q.push(A[i]-A[i-1]-1); for(;--k;){ ans -= Q.top(); Q.pop(); } printf("%d",ans); return 0; }

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

stove.cpp: In function 'int main()':
stove.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&k);
     ~~~~~^~~~~~~~~~~~~~
stove.cpp:19:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1;i<=n;i++) scanf("%d",&A[i]);
                       ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...