제출 #135150

#제출 시각아이디문제언어결과실행 시간메모리
135150dualityStove (JOI18_stove)C++11
100 / 100
29 ms2140 KiB
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back typedef long long int LLI; typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vpii; int T[100000],D[100000]; int main() { int i; int N,K; scanf("%d %d",&N,&K); for (i = 0; i < N; i++) scanf("%d",&T[i]); int t = T[N-1]-T[0]+1; for (i = 0; i < N; i++) D[i] = T[i+1]-T[i]-1; sort(D,D+N-1,greater<int>()); for (i = 0; i < K-1; i++) t -= D[i]; printf("%d\n",t); return 0; }

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

stove.cpp: In function 'int main()':
stove.cpp:14: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:15:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (i = 0; i < N; i++) scanf("%d",&T[i]);
                             ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...