Submission #18766766


Source Code Expand

#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

int a[200001];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m,k=1e9+69,ans=0;
    cin>>n>>m;
    vector<int> v;
    for (int i=1;i<=m;++i)
        cin>>a[i];
    sort(a,a+m+1);
    for (int i=1;i<=m;++i)
        if (a[i]-a[i-1]-1)
        {
            v.push_back(a[i]-a[i-1]-1);
            k=min(k,v.back());
        }
    if (n+1-a[m]-1)
    {
        v.push_back(n+1-a[m]-1);
        k=min(k,v.back());
    }
    for (int i : v)
        ans+=((i+k-1)/k);
    cout<<ans;
    return 0;
}

Submission Info

Submission Time
Task D - Stamp
User ScarletS
Language C++ (GCC 9.2.1)
Score 400
Code Size 644 Byte
Status AC
Exec Time 48 ms
Memory 5028 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 30
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All handmade_00.txt, handmade_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
handmade_00.txt AC 2 ms 3656 KiB
handmade_01.txt AC 2 ms 3584 KiB
random_00.txt AC 2 ms 3508 KiB
random_01.txt AC 5 ms 3516 KiB
random_02.txt AC 30 ms 4248 KiB
random_03.txt AC 42 ms 5028 KiB
random_04.txt AC 3 ms 3512 KiB
random_05.txt AC 35 ms 4280 KiB
random_06.txt AC 48 ms 4932 KiB
random_07.txt AC 4 ms 3452 KiB
random_08.txt AC 3 ms 3604 KiB
random_09.txt AC 43 ms 4260 KiB
random_10.txt AC 4 ms 3552 KiB
random_11.txt AC 37 ms 4244 KiB
random_12.txt AC 3 ms 3496 KiB
random_13.txt AC 4 ms 3604 KiB
random_14.txt AC 33 ms 4712 KiB
random_15.txt AC 29 ms 4080 KiB
random_16.txt AC 2 ms 3612 KiB
random_17.txt AC 4 ms 3592 KiB
random_18.txt AC 43 ms 4996 KiB
random_19.txt AC 5 ms 3568 KiB
random_20.txt AC 4 ms 3576 KiB
random_21.txt AC 7 ms 3708 KiB
random_22.txt AC 2 ms 3572 KiB
random_23.txt AC 5 ms 3544 KiB
sample_01.txt AC 2 ms 3616 KiB
sample_02.txt AC 4 ms 3616 KiB
sample_03.txt AC 5 ms 3612 KiB
sample_04.txt AC 4 ms 3456 KiB