제출 #556999

#제출 시각아이디문제언어결과실행 시간메모리
556999Ai7081Stove (JOI18_stove)C++17
0 / 100
0 ms212 KiB
#include <bits/stdc++.h> using namespace std; priority_queue<int> pq; int n, k, a, b, ans; int main() { scanf(" %d %d", &n, &k); scanf(" %d", &b); n--; ans -= b; while (n--) { scanf(" %d", &a); pq.push(a-b-1); b = a; } ans += a+1; k--; while (k--) ans -= pq.top(), pq.pop(); printf("%d", ans); return 0; }

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

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