제출 #593275

#제출 시각아이디문제언어결과실행 시간메모리
593275SummersStove (JOI18_stove)C++14
100 / 100
18 ms1908 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; long long a[1000000], dif[1000000]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n,i,j,k,br=0,num,k1,sum=0; cin>>n>>k; for(i=0;i<n;i++) { cin>>a[i]; if(i!=0)dif[i]=a[i]-a[i-1]; } sort(dif+1,dif+n); sum=a[n-1]-a[0]+1; for(i=n-1;i>n-k;i--) { sum-=dif[i]-1;br++;dif[i]=-1; } cout<<sum<<endl; }

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

stove.cpp: In function 'int main()':
stove.cpp:11:19: warning: unused variable 'j' [-Wunused-variable]
   11 |     long long n,i,j,k,br=0,num,k1,sum=0;
      |                   ^
stove.cpp:11:28: warning: unused variable 'num' [-Wunused-variable]
   11 |     long long n,i,j,k,br=0,num,k1,sum=0;
      |                            ^~~
stove.cpp:11:32: warning: unused variable 'k1' [-Wunused-variable]
   11 |     long long n,i,j,k,br=0,num,k1,sum=0;
      |                                ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...