Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <queue>
- #include <algorithm>
- #include <vector>
- #include <algorithm>
- #include <set>
- #include <cstring>
- #include <cmath>
- #include <map>
- #include <bits/stdc++.h>
- using namespace std;
- int cnt[6666];
- int cnt_after_zero[6666];
- int main() {
- ios_base::sync_with_stdio(false);
- int num;
- bool first_zero = false;
- memset(cnt_after_zero, 0, sizeof cnt_after_zero);
- while(true) {
- cin >> num;
- if(num == 11111) {
- break;
- }
- if(first_zero and num != 0) {
- cnt[num]++;
- cnt_after_zero[num]++;
- }
- if(num == 0) {
- first_zero = true;
- memset(cnt_after_zero, 0, sizeof cnt_after_zero);
- }
- }
- int b1 = -2e9, s1 = 2e9;
- for(int i = 600; i <= 6000; i++) {
- cnt[i] -= cnt_after_zero[i];
- if(cnt[i] > 0) {
- b1 = max(b1, i);
- s1 = min(s1, i);
- }
- }
- cout << b1 - s1 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement