Submission #616885

# Submission time Handle Problem Language Result Execution time Memory
616885 2022-08-01T07:26:35 Z 1ne Sails (IOI07_sails) C++14
0 / 100
39 ms 6312 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]++;
		}
	}
	cout<<ans<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 2004 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 2260 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 2132 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 2700 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 2756 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 3052 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 39 ms 6312 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 3724 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 4204 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -