Submission #19724518


Source Code Expand

Copy
#include <bits/stdc++.h>
#define INF 999999
using namespace std;
typedef long long ll;
ll N, M;


int main(){
    ll ans=0;
    cin >> N >> M;
    if(M==0){
        cout << 1 << endl;
        return 0;
    }
    ll A[M+2];
    A[0] = 0;
    A[M+1] = N+1;
    for(int i=1; i<=M; i++){
        cin >> A[i];
    }
    sort(A, A+M+2);

    ll shironum = 0;
    ll cnt=0;
    ll shiromin = INF;
    map<ll,ll> mp;
    for(int i=1; i<M+2; i++){
        if(A[i]-A[i-1]-1 >0){
            shiromin = min(shiromin, A[i]-A[i-1]-1 );
            // cout<<A[i]-A[i-1]<<endl;
            mp[A[i]-A[i-1]-1]++;
        }
    }
    auto begin = mp.begin(), end = mp.end();
    for (auto iter = begin; iter != end; iter++) {
        // cout << "key = " << iter->first << "\n";
        // cout << "value = " << iter->second << "\n";
        ans += ((iter->first + (shiromin-1)) / shiromin) *iter->second;
    }

    cout << ans << endl;
    
    return 0;
}



Submission Info

Submission Time
Task D - Stamp
User k0m
Language C++ (GCC 9.2.1)
Score 0
Code Size 992 Byte
Status WA
Exec Time 101 ms
Memory 6444 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:24:8: warning: unused variable ‘shironum’ [-Wunused-variable]
   24 |     ll shironum = 0;
      |        ^~~~~~~~
./Main.cpp:25:8: warning: unused variable ‘cnt’ [-Wunused-variable]
   25 |     ll cnt=0;
      |        ^~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 4
AC × 29
WA × 1
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 8 ms 3604 KB
handmade_01.txt AC 2 ms 3560 KB
random_00.txt AC 3 ms 3640 KB
random_01.txt AC 2 ms 3644 KB
random_02.txt AC 72 ms 6056 KB
random_03.txt AC 101 ms 6332 KB
random_04.txt AC 2 ms 3640 KB
random_05.txt AC 68 ms 6100 KB
random_06.txt AC 100 ms 6444 KB
random_07.txt WA 2 ms 3428 KB
random_08.txt AC 3 ms 3584 KB
random_09.txt AC 63 ms 4992 KB
random_10.txt AC 2 ms 3432 KB
random_11.txt AC 46 ms 4576 KB
random_12.txt AC 2 ms 3556 KB
random_13.txt AC 2 ms 3536 KB
random_14.txt AC 72 ms 4964 KB
random_15.txt AC 51 ms 4844 KB
random_16.txt AC 2 ms 3480 KB
random_17.txt AC 3 ms 3644 KB
random_18.txt AC 84 ms 5280 KB
random_19.txt AC 2 ms 3608 KB
random_20.txt AC 2 ms 3504 KB
random_21.txt AC 14 ms 3736 KB
random_22.txt AC 2 ms 3508 KB
random_23.txt AC 9 ms 3668 KB
sample_01.txt AC 2 ms 3504 KB
sample_02.txt AC 2 ms 3444 KB
sample_03.txt AC 2 ms 3528 KB
sample_04.txt AC 2 ms 3636 KB