Submission #26289770


Source Code Expand

#include <bits/stdc++.h>
#define sz(c) int(c.size())
#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)
using namespace std;
using ll = long long;

#ifdef LOCAL
#include <local/debug.h>
#else
#define debug(...) (void)0
#endif

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n;
  cin >> n;
  map<int, int> c;
  rep(i, 0, n) {
    int a, b;
    cin >> a >> b;
    c[a]++;
    c[a + b]--;
  }
  debug(c);

  vector<int> D(n + 1);
  int in = 0, prev = 0;
  for (auto [k, v] : c) {
    D[in] += k - prev;
    in += v;
    prev = k;
  }
  rep(i, 1, n + 1) cout << D[i] << ' ';
  cout << '\n';
}

Submission Info

Submission Time
Task D - Online games
User ami
Language C++ (GCC 9.2.1)
Score 400
Code Size 712 Byte
Status AC
Exec Time 252 ms
Memory 22732 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 24
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.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
Case Name Status Exec Time Memory
example_00.txt AC 9 ms 3620 KiB
example_01.txt AC 4 ms 3632 KiB
hand_00.txt AC 55 ms 3928 KiB
hand_01.txt AC 4 ms 3612 KiB
hand_02.txt AC 150 ms 13492 KiB
hand_03.txt AC 218 ms 22520 KiB
hand_04.txt AC 5 ms 3572 KiB
hand_05.txt AC 2 ms 3632 KiB
hand_06.txt AC 57 ms 3892 KiB
hand_07.txt AC 36 ms 3724 KiB
hand_08.txt AC 184 ms 22696 KiB
hand_09.txt AC 225 ms 22692 KiB
random_00.txt AC 101 ms 4684 KiB
random_01.txt AC 101 ms 4736 KiB
random_02.txt AC 97 ms 4516 KiB
random_03.txt AC 98 ms 4348 KiB
random_04.txt AC 99 ms 4568 KiB
random_05.txt AC 149 ms 11072 KiB
random_06.txt AC 149 ms 10908 KiB
random_07.txt AC 149 ms 10952 KiB
random_08.txt AC 252 ms 22520 KiB
random_09.txt AC 240 ms 22732 KiB
random_10.txt AC 227 ms 22692 KiB
random_11.txt AC 236 ms 22684 KiB