제출 #507243

#제출 시각아이디문제언어결과실행 시간메모리
507243amukkalirStove (JOI18_stove)C++17
100 / 100
33 ms2140 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define pii pair<ll,ll> #define se second #define fi first #define pb push_back #define wek puts("wekwek") #define wik puts("-------") const int nax = 1e5; int n, k; int t[nax+5]; signed main () { scanf("%d %d", &n, &k); priority_queue<int,vector<int>,greater<int>> pq; int ans = n; for(int i=0; i<n; i++) { scanf("%d", &t[i]); if(i > 0) { pq.push(t[i]-t[i-1]-1); } } for(int i=0; i<n-k; i++) { ans += pq.top(); pq.pop(); } printf("%d", ans); } /* */

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

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