제출 #732245

#제출 시각아이디문제언어결과실행 시간메모리
732245blackslexStove (JOI18_stove)C++17
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; const int N = 1e5 + 5; ll n, m, a[N], ans; vector<ll> v; int main() { scanf("%lld %lld", &n, &m); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]), v.emplace_back(a[i] - a[i - 1] - 1); sort(v.begin(), v.end()); for (int i = 1; i <= n - m; i++) ans += v[i]; printf("%lld", ans + n); }

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

stove.cpp: In function 'int main()':
stove.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%lld %lld", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~
stove.cpp:12:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for (int i = 1; i <= n; i++) scanf("%lld", &a[i]), v.emplace_back(a[i] - a[i - 1] - 1);
      |                                  ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...