# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1083270 | Dennis_Jason | Stove (JOI18_stove) | C++17 | 17 ms | 2620 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define NMAX 2005
#define pb push_back
#define eb emplace_back
#define MOD 100003
#define nl '\n'
#define LLONG_MAX 9223372036854775807
#define pii pair<int,int>
#define tpl tuple<int,int,int>
//#pragma GCC optimize("O3")
#define INF 2147483647
using namespace std;
ifstream fin("aib.in");
ofstream fout("aib.out");
/*
*
*
================DEMONSTRATION===================
5 5
RGRGW
GRRGW
WGGWR
RWRGW
RGWGW
=====================END========================
*/
int n,k;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>k;
vector<pii>v(n+1);
for(int i=1;i<=n;++i)
{
cin>>v[i].first;
v[i].second=v[i].first+1;
}
vector<int>timp(n);
for(int i=2;i<=n;++i)
{
int aux=(v[i].first-v[i-1].second);
timp[i-1]=aux;
// cout<<timp[i-1]<<" ";
}
sort(timp.begin()+1,timp.end(),greater<int>());
int ans=0;
k--;
for(int i=1;i<n && k--;++i)
{
ans+=timp[i];
}
cout<<(v[n].second-v[1].first)-ans;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |