Submission #821390

#TimeUsernameProblemLanguageResultExecution timeMemory
821390TwinHterCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back
#define pf push_front
#define popf pop_front

string alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
const ll pd = 1e9+7;//998244353;
ll oo = 1e18 + 1, tc;
const ll MX = 240010;
void solve() {
	int n, k; cin >> n >> k;
	ll a[n+10], time = 0, b[n+10];
	for(int i=1; i<=n; i++) cin >> a[i];
	for(int i=2; i<=n; i++) b[i-1] = max(a[i]-a[i-1]-1, (ll)0);
	
	sort(b+1, b+n, greater<ll>());
	time = a[n]-a[1]+1;
	for(int i=1; i<=min(n-1, k-1); i++) time -= b[i];
	cout << time << endl;
}
int main (){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//freopen("cf.inp", "r", stdin); freopen("cf.out", "w", stdout);
	//cin >> tc; while(tc--)
	solve();
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cciQ2WTG.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc75tZsI.o:combo.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cciQ2WTG.o: in function `main':
grader.cpp:(.text.startup+0x4c): undefined reference to `guess_sequence[abi:cxx11](int)'
collect2: error: ld returned 1 exit status