Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize("O3")
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- #define double long double
- #define _FastIO ios_base::sync_with_stdio(0); cin.tie(0)
- #define F first
- #define S second
- signed main()
- {
- _FastIO;
- /*
- 2 8 3
- 8 2 3
- 2 3 (+3 free time) 8
- 1 2 3 4 5
- 5 4 3 2 1
- 1 2 3 5 4
- 5 6 7
- 7 5 6
- 5 6 7
- 1 2 3 4
- 4 1 2 3
- */
- /*
- // D
- int n , m = 0 , s = 0 , x;
- cin >> n;
- while(n--){
- cin >> x;
- m = max(m , x);
- s += x;
- }
- cout << max(s , m * 2) << '\n';
- */
- /*
- 3
- 1 5
- 7 8
- 3 7
- 1 5
- 3 7
- 7 8
- 3
- 3 4
- 2 5
- 1 6
- 1 6
- 2 5
- 3 4
- */
- /*
- // E
- int n , x , y;
- cin >> n;
- vector<pair<int , int> > v;
- for(int i = 0; i < n; i++){
- cin >> x >> y;
- v.push_back({x , y});
- }
- sort(v.begin() , v.end());
- int cnt = 0 , ans = 0;
- priority_queue<int , vector<int> , greater<> > q;
- q.push(v[0].S);
- for(int i = 1; i < n; i++){
- while(!q.empty()){
- if(q.top() < v[i].F)
- q.pop();
- else
- break;
- }
- // queuedaki butun elementler >= v[i].F
- ans += q.size();
- q.push(v[i].S);
- *}
- cout << ans << '\n';
- */
- /*
- 1 9
- 10 20
- 9 11
- */
- /*
- 1 20
- 2 3
- 3 4
- 4 5
- 5 6
- */
- /*5 2
- 1 5
- 8 10
- 3 6
- 2 5
- 6 9
- 1 5
- 6 9
- 2 5
- 8 10
- */
- // 9 10
- /*
- 1 2
- 2 4
- 1 10
- */
- // F
- /*
- int n , k , l , r;
- cin >> n >> k;
- vector<pair<int , int> > v;
- for(int i = 0; i < n; i++){
- cin >> l >> r;
- v.push_back({r , l});
- }
- sort(v.begin() , v.end());
- multiset<int> ms;
- while(k--)
- ms.insert(0);
- int ans = 0;
- // 0 3 4 5 6
- for(int i = 0; i < n; i++){
- r = v[i].F , l = v[i].S;
- // l - baslama , r - qurtarma
- // eger kimse gire bilirse gonder onu
- // bir nece neferi gondere bilirsense, sonradan bos olani gonder
- // lower_bound >=
- // upper_bound >
- // --lower_bound <
- // --upper_bound <=
- auto it = ms.upper_bound(l);
- if(it == ms.begin()) // heckim gede bilmir, hami doludur
- continue;
- it--;
- ms.erase(it);
- ms.insert(r);
- ans++;
- }
- cout << ans << '\n';
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement