제출 #1229059

#제출 시각아이디문제언어결과실행 시간메모리
1229059xxducdatStove (JOI18_stove)C++20
100 / 100
31 ms1220 KiB
#include <bits/stdc++.h> using namespace std; int t[100005]; int main(){ if(fopen("STOVE.inp", "r")){ freopen("STOVE.inp", "r", stdin); freopen("STOVE.out", "w", stdout); } int n,k; cin>>n>>k; vector<int> ti; for(int i=0;i<n;i++){ cin>>t[i]; } for(int i=0;i<n-1;i++){ ti.push_back(t[i+1]-t[i]-1); } long long T=n; sort(ti.begin(),ti.end()); for(int i=0;i<n-k;i++){ T+=ti[i]; } cout<<T; }

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

stove.cpp: In function 'int main()':
stove.cpp:7:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |                 freopen("STOVE.inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
stove.cpp:8:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |                 freopen("STOVE.out", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...