56032023-08-02 16:47:31TomaSajtÁruszállítás (75 pont)cpp17Accepted 75/7532ms24580 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n, m;
  cin >> n >> m;

  vector<int> diff(n, 0);
  for (int i = 0; i < m; i++) {
    int s, e;
    cin >> s >> e;
    diff[s - 1] += 1;
    diff[e - 1] -= 1;
  }

  vector<int> v(n);
  partial_sum(diff.begin(), diff.end(), v.begin());
  cout << count(v.begin(), v.end(), 0) - 1;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1832 KiB
2Accepted0/032ms18968 KiB
3Accepted3/33ms3624 KiB
4Accepted3/33ms4120 KiB
5Accepted3/32ms4160 KiB
6Accepted3/32ms4364 KiB
7Accepted3/32ms4364 KiB
8Accepted4/43ms4280 KiB
9Accepted4/43ms4504 KiB
10Accepted4/43ms4608 KiB
11Accepted4/43ms5612 KiB
12Accepted4/43ms6388 KiB
13Accepted4/44ms6496 KiB
14Accepted4/46ms8128 KiB
15Accepted4/44ms8244 KiB
16Accepted4/47ms10140 KiB
17Accepted4/47ms11768 KiB
18Accepted4/47ms13440 KiB
19Accepted4/47ms12296 KiB
20Accepted4/48ms14232 KiB
21Accepted4/430ms23460 KiB
22Accepted4/432ms24580 KiB