제출 #1314329

#제출 시각아이디문제언어결과실행 시간메모리
1314329andraguosoStove (JOI18_stove)C++20
0 / 100
0 ms332 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) x.begin(), x.end() int main() { int n,k; cin>>n>>k; vector<ll> T(n), inbet; //inbetween /* k matches, prioritize time say k=1: optimal time is for L-F+1, as in s2 say k=2: optimal time depends, would pick the two consec numbers w/ the biggest diff so inbet are possible windows between each entry when k=3 */ for(int i=0; i<n; i++) cin>>T[i]; ll ans=T[n-1]-T[0]+1; // k=1 for(int i=1; i<n; i++) inbet.push_back(T[i]-T[i-1]-1); // each each sort(all(inbet)); // ordeno casitos para restarlos, minpos for(int i=0; i<k-1; i++) ans-=inbet[i]; cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...