Submission #903887

#TimeUsernameProblemLanguageResultExecution timeMemory
903887JakobZorzSails (IOI07_sails)C++17
40 / 100
1055 ms6904 KiB
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<limits.h> #include<math.h> #include<map> #include<set> #include<unordered_map> #include<unordered_set> #include<iomanip> #include<cstring> typedef long long ll; typedef unsigned long long ull; typedef long double ld; using namespace std; //const int MOD=1e9+7; //typedef pair<ll,ll>Point; //typedef pair<ll,ll>Line; //#define x first //#define y second void solve(){ int n; cin>>n; vector<pair<int,int>>arr(n); for(auto&i:arr) cin>>i.first>>i.second; sort(arr.begin(),arr.end()); int ph=0; multiset<int>s; ll r=0; for(auto [h,k]:arr){ for(int i=ph;i<h;i++) s.insert(0); vector<int>v; for(int i=0;i<k;i++){ v.push_back(*s.begin()); r+=v.back(); s.erase(s.begin()); } for(int i:v) s.insert(i+1); ph=h; } cout<<r<<"\n"; } int main(){ ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL); //freopen("bank.in","r",stdin);freopen("bank.out","w",stdout); int t=1;//cin>>t; while(t--)solve(); return 0; } /* 6 3 2 5 3 4 1 2 1 4 3 3 2 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...