제출 #1323437

#제출 시각아이디문제언어결과실행 시간메모리
1323437python_devopoverStove (JOI18_stove)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<int> a(n); for(int i = 0; i < n; i++) cin >> a[i]; if(k >= n){ cout << n << endl; return; } vector<int> pf(n); for(int i = 0; i + 1 < n; i++){ pf[i] = a[i + 1] - (a[i] + 1); } sort(all(pf)); int ans = n; for(int i = 0; i < n - k; i++) ans += pf[i]; cout << ans << endl; return; }

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

stove.cpp: In function 'int main()':
stove.cpp:16:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   16 |         return;
      |         ^~~~~~
stove.cpp:26:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   26 |     return;
      |     ^~~~~~