Submission #58932158


Source Code Expand

/// Msaa el 5ra
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i, a, b) for (int i = a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x, y)
#define popCnt(x) (__builtin_popcountll(x))
//#define int ll

using ll = long long;
using ii = pair<int, int>;
using ull = unsigned long long;

const int N = 2e5 + 5, A = 26, LG = 19, MOD = (119 << 23) +1, MOD2 = 1e9 + 7;
const long double PI = acos(-1);
const long double EPS = 1e-7;

const ll MAX = 1e15;


void doWork() {
    int n, c;
    cin >> n >> c;
    int ans = 1;
    vector<int> t(n);
    int prv = 0;
    f(i,0,n)    cin >> t[i];
    f(i,1,n)    if(t[i]-t[prv] >= c) ans += 1, prv=i;
    cout << ans << "\n";


}

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
//  cin >> t;
  while (t--) {
    doWork();
  }
}

Submission Info

Submission Time
Task A - Candy Button
User triplem5ds
Language C++ 20 (gcc 12.2)
Score 150
Code Size 999 Byte
Status AC
Exec Time 1 ms
Memory 3628 KiB

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 3544 KiB
00_sample_01.txt AC 1 ms 3548 KiB
00_sample_02.txt AC 1 ms 3388 KiB
01_random_00.txt AC 1 ms 3496 KiB
01_random_01.txt AC 1 ms 3444 KiB
01_random_02.txt AC 1 ms 3392 KiB
01_random_03.txt AC 1 ms 3468 KiB
01_random_04.txt AC 1 ms 3556 KiB
01_random_05.txt AC 1 ms 3424 KiB
01_random_06.txt AC 1 ms 3508 KiB
01_random_07.txt AC 1 ms 3564 KiB
02_handmade_00.txt AC 1 ms 3420 KiB
02_handmade_01.txt AC 1 ms 3628 KiB
02_handmade_02.txt AC 1 ms 3464 KiB
02_handmade_03.txt AC 1 ms 3364 KiB
02_handmade_04.txt AC 1 ms 3504 KiB
02_handmade_05.txt AC 1 ms 3400 KiB