Submission #616888

# Submission time Handle Problem Language Result Execution time Memory
616888 2022-08-01T07:27:11 Z 1ne Sails (IOI07_sails) C++14
0 / 100
1000 ms 3876 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;cin>>n;
	vector<pair<int,int>>arr(n);
	vector<long long>v(100001,0);
	for (int i = 0;i<n;++i){
		cin>>arr[i].first>>arr[i].second;
	}
	sort(arr.begin(),arr.end(),[&](auto x,auto y){
		return x.first < y.first;
	});
	long long ans = 0;
	priority_queue<pair<long long,long long>>q;
	int right = 0;
	for (int i = 0;i<n;++i){
		while(right < arr[i].first){
			q.push({-v[right],right});
			++right;
		}
		for (int j = 0;j<arr[i].second;++j){
			auto u = q.top();
			q.pop();
			ans+=-u.first;
			v[u.second]++;
			q.push({-v[u.second],u.second});
		}
	}
	cout<<ans<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1108 KB Output is correct
2 Incorrect 1 ms 980 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 419 ms 1216 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 1592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 1556 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1043 ms 1860 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 3876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 2004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 2288 KB Time limit exceeded
2 Halted 0 ms 0 KB -