Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- vector<pair<int, int>> vp(n);
- for(auto &[a, b]: vp) cin>>a>>b;
- int ans = 0;
- for(int i=0; i<24; i++)
- {
- int tmp = 0;
- for(auto [w, x]: vp)
- {
- if((x+i)%24<=17 && (x+i)%24>=9)
- tmp += w;
- }
- ans = max(ans, tmp);
- }
- cout<<ans<<"\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment