제출 #1249347

#제출 시각아이디문제언어결과실행 시간메모리
1249347ammakaStove (JOI18_stove)C++20
100 / 100
12 ms1864 KiB
//#include <GOD>
//kole shahr khakestary , bala sar man ranginkamon
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define pb push_back
#define len length	
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define freo freopen("guard.out","w",stdout)
#define frei freopen("guard.in","r",stdin)

const ll inf=1e18+10;
const ll mod=1e9+7;
const ll maxn=(1e5)+10,maxm=1e5+10,sq=310+10,maxa=(1<<maxn),mlg=32;

ll t[maxn],a[maxn];

int main(){
    // frei;
    // freo;
	FAST_IO;
	// ll t;
	// cin>>t;
	// while(t--){

	// }
    ll n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>t[i];
    }
    for(int i=1;i<=n-1;i++){
        a[i]=t[i+1]-t[i]-1;
    }
    sort(a+1,a+n);
    reverse(a+1,a+n);
    ll ans=0;
    for(int i=1;i<=k-1;i++){
        ans+=a[i];
    }
    cout<<t[n]-t[1]+1-ans<<endl;
}

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

stove.cpp:15:53: warning: left shift count >= width of type [-Wshift-count-overflow]
   15 | const ll maxn=(1e5)+10,maxm=1e5+10,sq=310+10,maxa=(1<<maxn),mlg=32;
      |                                                    ~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...