125652024-12-23 13:14:034rt3xp02016. januárcpp17Accepted 140ms4152 KiB
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,k; cin >> n >> k;
  vector<int> v(n,0);
  while(k--){
    int x,y; cin >> x >> y;
    x--; v[x]++;
    if(y<n) v[y]--;
  }
  for(int i=1;i<n;i++) v[i]+=v[i-1];
  sort(v.begin(),v.end());
  cout << v[n/2];
}
1 - Accepted
Memory: 320KiB
Time: 1ms

Program's output:
1
Expected output:
1
Checker output:
ok 1 number(s): "1"

2 - Accepted
Memory: 1848KiB
Time: 63ms

Program's output:
3707
Expected output:
3707
Checker output:
ok 1 number(s): "3707"

3 - Accepted
Memory: 3060KiB
Time: 93ms

Program's output:
3413
Expected output:
3413
Checker output:
ok 1 number(s): "3413"

4 - Accepted
Memory: 3384KiB
Time: 114ms

Program's output:
3071
Expected output:
3071
Checker output:
ok 1 number(s): "3071"

5 - Accepted
Memory: 4152KiB
Time: 118ms

Program's output:
596
Expected output:
596
Checker output:
ok 1 number(s): "596"

6 - Accepted
Memory: 1080KiB
Time: 30ms

Program's output:
2408
Expected output:
2408
Checker output:
ok 1 number(s): "2408"

7 - Accepted
Memory: 824KiB
Time: 18ms

Program's output:
699
Expected output:
699
Checker output:
ok 1 number(s): "699"

8 - Accepted
Memory: 1592KiB
Time: 34ms

Program's output:
362
Expected output:
362
Checker output:
ok 1 number(s): "362"

9 - Accepted
Memory: 2360KiB
Time: 79ms

Program's output:
4983
Expected output:
4983
Checker output:
ok 1 number(s): "4983"

10 - Accepted
Memory: 3384KiB
Time: 116ms

Program's output:
6754
Expected output:
6754
Checker output:
ok 1 number(s): "6754"

11 - Accepted
Memory: 4152KiB
Time: 140ms

Program's output:
6531
Expected output:
6531
Checker output:
ok 1 number(s): "6531"

12 - Accepted
Memory: 3384KiB
Time: 108ms

Program's output:
2473
Expected output:
2473
Checker output:
ok 1 number(s): "2473"

13 - Accepted
Memory: 3900KiB
Time: 123ms

Program's output:
2375
Expected output:
2375
Checker output:
ok 1 number(s): "2375"

14 - Accepted
Memory: 824KiB
Time: 17ms

Program's output:
2051
Expected output:
2051
Checker output:
ok 1 number(s): "2051"

15 - Accepted
Memory: 1336KiB
Time: 39ms

Program's output:
1691
Expected output:
1691
Checker output:
ok 1 number(s): "1691"

16 - Accepted
Memory: 2360KiB
Time: 68ms

Program's output:
1400
Expected output:
1400
Checker output:
ok 1 number(s): "1400"

17 - Accepted
Memory: 1084KiB
Time: 28ms

Program's output:
3428
Expected output:
3428
Checker output:
ok 1 number(s): "3428"

18 - Accepted
Memory: 1592KiB
Time: 41ms

Program's output:
895
Expected output:
895
Checker output:
ok 1 number(s): "895"

19 - Accepted
Memory: 2292KiB
Time: 63ms

Program's output:
821
Expected output:
821
Checker output:
ok 1 number(s): "821"

20 - Accepted
Memory: 2872KiB
Time: 79ms

Program's output:
482
Expected output:
482
Checker output:
ok 1 number(s): "482"

21 - Accepted
Memory: 3820KiB
Time: 43ms

Program's output:
167
Expected output:
167
Checker output:
ok 1 number(s): "167"

22 - Accepted
Memory: 736KiB
Time: 17ms

Program's output:
4059
Expected output:
4059
Checker output:
ok 1 number(s): "4059"

23 - Accepted
Memory: 1336KiB
Time: 34ms

Program's output:
1859
Expected output:
1859
Checker output:
ok 1 number(s): "1859"

24 - Accepted
Memory: 2104KiB
Time: 64ms

Program's output:
1523
Expected output:
1523
Checker output:
ok 1 number(s): "1523"

25 - Accepted
Memory: 3060KiB
Time: 93ms

Program's output:
6036
Expected output:
6036
Checker output:
ok 1 number(s): "6036"

26 - Accepted
Memory: 3384KiB
Time: 98ms

Program's output:
836
Expected output:
836
Checker output:
ok 1 number(s): "836"