Submission #58933454


Source Code Expand

// I AM A MUSLIM

#include "bits/stdc++.h"

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#define fast_io std::ios::sync_with_stdio(0);std::cin.tie(0)
#define lli long long int
#define flush fflush(stdout)
#define BL printf("\n")
#define yn(a, b) printf("%s\n", a >= b ? "Yes":"No")
#define safe_mod(a, M) ((a%M+M)%M)
// #define int lli

using pii = std::pair<int,int>;

const int MOD = 1000000007;
const int mxN = 100100;

signed main() {
    int testCases=1;
    // scanf("%d",&testCases);
    
    for (int TC = 1; TC <= testCases; TC++) {
        int n, c;
        scanf("%d%d",&n,&c);
        int ans = 1;
        int lst; scanf("%d",&lst);
        for (int i = 1,v; i < n; i++) {
            scanf("%d",&v);
            if (v-lst >= c) {
                ans++;
                lst = v;
            }
        }
        
        printf("%d\n", ans);
        
    }
    
    return 0;
}

/*

*/

Submission Info

Submission Time
Task A - Candy Button
User MArhamAA1422
Language C++ 20 (Clang 16.0.6)
Score 150
Code Size 987 Byte
Status AC
Exec Time 1 ms
Memory 3848 KiB

Compile Error

./Main.cpp:5:13: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma GCC optimize("O3,unroll-loops")
            ^
./Main.cpp:6:13: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
            ^
./Main.cpp:18:11: warning: unused variable 'MOD' [-Wunused-const-variable]
const int MOD = 1000000007;
          ^
./Main.cpp:19:11: warning: unused variable 'mxN' [-Wunused-const-variable]
const int mxN = 100100;
          ^
4 warnings generated.

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 150 / 150
Status
AC × 3
AC × 17
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3780 KiB
00_sample_01.txt AC 1 ms 3520 KiB
00_sample_02.txt AC 1 ms 3728 KiB
01_random_00.txt AC 1 ms 3480 KiB
01_random_01.txt AC 1 ms 3584 KiB
01_random_02.txt AC 1 ms 3772 KiB
01_random_03.txt AC 1 ms 3732 KiB
01_random_04.txt AC 1 ms 3780 KiB
01_random_05.txt AC 1 ms 3768 KiB
01_random_06.txt AC 1 ms 3848 KiB
01_random_07.txt AC 1 ms 3772 KiB
02_handmade_00.txt AC 1 ms 3708 KiB
02_handmade_01.txt AC 1 ms 3708 KiB
02_handmade_02.txt AC 1 ms 3768 KiB
02_handmade_03.txt AC 1 ms 3640 KiB
02_handmade_04.txt AC 1 ms 3600 KiB
02_handmade_05.txt AC 1 ms 3704 KiB