Submission #19724261


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;
    }
    bool masu[N+2];
    

    masu[0] = false;
    for(int i=1; i<N+1; i++){
        masu[i] = true;
    }
    masu[N+1] = false;
    ll shironum = 0;
    ll kukanmin = INF;


    ll A;
    
    for(int i=0; i<M; i++){
        cin >> A;
        masu[A] = false;
    }
    ll cnt = 0;
    map<ll,ll> mp;
    for(int i=1; i<=N+1; i++){
        
        if(!masu[i]){
            if(masu[i-1]){
                kukanmin = min(cnt, kukanmin);
                mp[cnt]++;
                cnt = 0;
            }
        }else{
            cnt++;
        }

        if(i==N+1){
            if(masu[i-1]){
                kukanmin = min(cnt, kukanmin);
                mp[cnt]++;
                cnt = 0;
            }
        }
    }
    auto begin = mp.begin(), end = mp.end();
    for (auto iter = begin; iter != end; iter++) {
        ans += ((iter->first + (kukanmin-1)) / kukanmin) *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 1232 Byte
Status RE
Exec Time 2257 ms
Memory 981472 KB

Compile Error

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
RE × 1
AC × 15
TLE × 5
RE × 10
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 3520 KB
handmade_01.txt AC 2 ms 3420 KB
random_00.txt AC 2 ms 3392 KB
random_01.txt TLE 2223 ms 979908 KB
random_02.txt TLE 2237 ms 981472 KB
random_03.txt TLE 2237 ms 981196 KB
random_04.txt AC 10 ms 3524 KB
random_05.txt TLE 2257 ms 962500 KB
random_06.txt TLE 2237 ms 971424 KB
random_07.txt RE 2052 ms 901828 KB
random_08.txt AC 5 ms 3524 KB
random_09.txt AC 55 ms 3768 KB
random_10.txt RE 327 ms 101628 KB
random_11.txt AC 39 ms 3644 KB
random_12.txt AC 2 ms 3436 KB
random_13.txt RE 115 ms 3316 KB
random_14.txt RE 392 ms 101404 KB
random_15.txt AC 43 ms 3680 KB
random_16.txt AC 2 ms 3372 KB
random_17.txt RE 119 ms 3360 KB
random_18.txt RE 412 ms 103604 KB
random_19.txt RE 112 ms 3528 KB
random_20.txt AC 9 ms 3372 KB
random_21.txt AC 10 ms 3560 KB
random_22.txt RE 329 ms 103160 KB
random_23.txt RE 115 ms 3316 KB
sample_01.txt RE 112 ms 3160 KB
sample_02.txt AC 2 ms 3484 KB
sample_03.txt AC 3 ms 3572 KB
sample_04.txt AC 2 ms 3524 KB