# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
115495 | 2019-06-07T22:40:57 Z | thebes | Sails (IOI07_sails) | C++14 | 1000 ms | 3692 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; priority_queue<ll> q; ll N, i, nxt=1, ans; vector<ll> tmp; pair<ll,ll> arr[100005]; int main(){ for(scanf("%lld",&N),i=1;i<=N;i++) scanf("%lld%lld",&arr[i].first,&arr[i].second); sort(arr+1,arr+N+1,[](pair<ll,ll>i,pair<ll,ll>j){return i.first<j.first;}); for(i=1;i<=N;i++){ while(nxt<=arr[i].first) q.push(0), nxt++; while(arr[i].second--){ ans += -q.top(); tmp.push_back(q.top()-1); q.pop(); } for(auto v : tmp) q.push(v); tmp.clear(); } printf("%lld\n",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 10 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 181 ms | 384 KB | Output is correct |
2 | Correct | 178 ms | 1604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1067 ms | 1048 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1062 ms | 1168 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1065 ms | 1604 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1070 ms | 3692 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1070 ms | 2044 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1072 ms | 2488 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |