제출 #380359

#제출 시각아이디문제언어결과실행 시간메모리
380359PixelCatStove (JOI18_stove)C++14
100 / 100
23 ms2048 KiB
/* /^--^\ \____/ / \ _____ _ __ __ ____ _ ____ ____ _____ | || ()_)| |\ \/ /| ===|| |__ / (__` / () \|_ _| \__ __/ |_| |_|/_/\_\|____||____|\____)/__/\__\ |_| |^|^\ \^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^|^| | | |\ \| | | | | | | | | | | | | | | | | | | | | | | | | #####/ /################################################# | | |\/ | | | | | | | | | | | | | | | | | | | | | | | | | |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|*/ //#pragma GCC optimize("O4,unroint-loops,no-stack-protector") #include <bits/stdc++.h> using namespace std; using ll=long long; using ull=unsigned long long; using pii=pair<ll,ll>; //using pii=pair<int,int>; #define int ll //__int128 #define double long double #define For(i,a,b) for(int i=a;i<=b;i++) #define Forr(i,a,b) for(int i=a;i>=b;i--) #define F first #define S second #define L(id) (id*2+1) #define R(id) (id*2+2) #define LO(x) (x&(-x)) #define eb emplace_back #define all(x) x.begin(),x.end() #define sz(x) ((int)x.size()) #define mkp make_pair #define MOD (int)(1e9+7) #define INF (int)(1e15) #define EPS (1e-9) #ifdef LOCALMEOW #define debug(...) do{\ cerr << __LINE__ <<\ " : ("#__VA_ARGS__ << ") = ";\ _OUT(__VA_ARGS__);\ }while(0) template<typename T> void _OUT(T x) { cerr << x << "\n"; } template<typename T,typename...I> void _OUT(T x,I ...tail) { cerr << x << ", "; _OUT(tail...); } #else #define debug(...) #endif inline void NYA(){ ios::sync_with_stdio(false); cin.tie(0); } mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); //mt19937 rng((ull)new char); int gcd(int a,int b) { return b==0?a:gcd(b,a%b); } int lcm(int a,int b) { return a/gcd(a,b)*b; } int fpow(int b,int p,const int &mod){ int ans=1,now=b; while(p){ if(p&1) ans=ans*now%mod; p/=2; now=now*now%mod; } return ans; } int fpow(int b,int p) { return fpow(b,p,MOD); } void chmin(int &a,const int &b) { if(b<a) a=b; } void chmax(int &a,const int &b) { if(b>a) a=b; } int32_t main(){ NYA(); //shinon >/////< int n,k; cin>>n>>k; vector<int> v(n); for(auto &i:v) cin>>i; int ans=v.back()+1-v[0]; For(i,0,n-2) v[i]=v[i+1]-v[i]-1; v.pop_back(); sort(all(v)); reverse(all(v)); For(i,0,k-2) ans-=v[i]; cout<<ans<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...