Submission #886435

#TimeUsernameProblemLanguageResultExecution timeMemory
886435artixkrishnaStove (JOI18_stove)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll= long long; int main(){ int n, k, a[1e5+5]; vector<int> res; for(int i=0; i<=n; i++){ cin>>a[i]; if(i>1) res.push_back(a[i]-a[i-1]); } sort(res.begin(), res.end()); int ans =n; for(int i=0; i<n-k; i++){ ans+=res[i]-1; } cout<<ans; }

Compilation message (stderr)

stove.cpp: In function 'int main()':
stove.cpp:5:24: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    5 |         int n, k, a[1e5+5];
      |                     ~~~^~
stove.cpp:5:24: error: could not convert '(1.0e+5 + (double)5)' from 'double' to 'long unsigned int'
stove.cpp:5:24: error: size of array 'a' has non-integral type 'double'