# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
723027 |
2023-04-13T07:36:44 Z |
ooscode |
Stove (JOI18_stove) |
C++17 |
|
0 ms |
0 KB |
// IN THE NAME OF ALLAH #include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false);cin.tie(NULL)#define wall cerr << "------------------------------------" << endl#define pb push_back#define pob pop_back#define F first#define S second#define all(x) x.begin() , x.end()#define scan scanf#define print printf#define outs(x) print("%lld " , x)#define out(x) print("%lld\n" , x)#define in(x) scan("%lld" , &x)// #define int ll mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #pragma GCC optimize("Ofast") typedef long long ll;typedef pair<int , int> pii;typedef pair<ll , ll> pll;typedef pair<pii,int> piii;typedef pair<pll , ll> plll; const int N = 1e5+10;const int K = 2e5+10;const ll mod = 1e9+7;const ll INF = 1e18+10;const int P = 31;const int lg = 25;int n , m;ll a[N];int ans;set<pii> s;void get() { while(s.size() != m-1) { ans += (*s.begin()).F - 1; s.erase(s.begin()); }}int main(){ fast; cin >> n >> m; for(int i = 1 ; i <= n ; i++) cin >> a[i]; ans = n; for(int i = 1 ; i < n ; i++) s.insert({a[i+1] - a[i] , i}); get(); cout << ans << "\n"; return 0;}
Compilation message
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status