제출 #1266142

#제출 시각아이디문제언어결과실행 시간메모리
1266142codergStove (JOI18_stove)C++20
100 / 100
13 ms1732 KiB
/* 01.09.2025 */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vector<ll>> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<bool> vb; typedef vector<pair<ll,ll>> vpll; typedef vector<pair<int,int>> vpii; #define el "\n" #define yes cout<<"Yes\n" #define no cout<<"No\n" #define all(x) x.begin(),x.end() #define srt(x) sort(x.begin(),x.end()) #define rev(x) reverse(x.begin(),x.end()) #define tests \ ll tt; \ cin >> tt; \ while (tt--) #define sz(x) (ll)x.size() #define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); void setIO(string name = ""){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if(name.size()){ freopen((name + ".in").c_str(), "r", stdin);freopen((name + ".out").c_str(), "w", stdout);}} #define db double #define F first #define S second #define vvb vector<vector<bool>> #define pii pair<int,int> #define outel(x) cout<<x<<'\n' #define out(x) cout<<x const ll INF=1e9; const db EPS=1e-7; signed main(){ fastIO; int n,k;cin>>n>>k; vector<int>x, v(n); for(int i=0;i<n;i++){ cin>>v[i]; if(i)x.push_back(v[i]-v[i-1]-1); } srt(x); int sum=0; for(int i=0;i<n-k;i++)sum+=x[i]; out(sum+n); return 0; }

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

stove.cpp: In function 'void setIO(std::string)':
stove.cpp:24:113: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 | void setIO(string name = ""){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if(name.size()){ freopen((name + ".in").c_str(), "r", stdin);freopen((name + ".out").c_str(), "w", stdout);}}
      |                                                                                                          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stove.cpp:24:157: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 | void setIO(string name = ""){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if(name.size()){ freopen((name + ".in").c_str(), "r", stdin);freopen((name + ".out").c_str(), "w", stdout);}}
      |                                                                                                                                                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...