Submission #27655700


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  int n, d;
  cin >>n >> d;

  vii a(n);
  rep(i,0,n) cin >> a[i].snd >> a[i].fst;

  sort(all(a));

  int x = 0;
  int ans = 0;
  for (auto [r, l]:  a) {
    if (x >= l) continue;
    x = r+d-1;
    ++ans;
  }
  cout << ans << '\n';
}

Submission Info

Submission Time
Task D - Destroyer Takahashi
User hoke_t
Language C++ (GCC 9.2.1)
Score 400
Code Size 1107 Byte
Status AC
Exec Time 57 ms
Memory 4828 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 18
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_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 03_all_1_00.txt, 04_all_1e9_00.txt, 05_hack_00.txt, 05_hack_01.txt, 05_hack_02.txt, 05_hack_03.txt, 06_distinct_00.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 13 ms 3620 KiB
00_sample_01.txt AC 2 ms 3652 KiB
00_sample_02.txt AC 2 ms 3560 KiB
01_small_00.txt AC 2 ms 3584 KiB
01_small_01.txt AC 2 ms 3584 KiB
01_small_02.txt AC 2 ms 3464 KiB
01_small_03.txt AC 2 ms 3608 KiB
01_small_04.txt AC 2 ms 3508 KiB
02_random_00.txt AC 25 ms 3572 KiB
02_random_01.txt AC 10 ms 3588 KiB
02_random_02.txt AC 32 ms 3940 KiB
03_all_1_00.txt AC 43 ms 4772 KiB
04_all_1e9_00.txt AC 48 ms 4828 KiB
05_hack_00.txt AC 18 ms 3620 KiB
05_hack_01.txt AC 46 ms 4424 KiB
05_hack_02.txt AC 57 ms 4784 KiB
05_hack_03.txt AC 55 ms 4740 KiB
06_distinct_00.txt AC 56 ms 4688 KiB