# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
343412 |
2021-01-03T22:40:46 Z |
updown1 |
Sails (IOI07_sails) |
C++17 |
|
1000 ms |
4116 KB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include <stack>
#include <bitset>
//#include "molecules.h"
using namespace std;
#define ll long long
const int MAXN = 1e5 + 5;
vector<int> cnt(MAXN);
int main() {
cin.tie(0);ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<pair<int, int>> p;
for (int i = 0; i < n; i++) {
int a, b;
cin >> a >> b;
p.push_back({ a, b });
}
sort(p.begin(), p.end());
ll ans = 0;
for (int i = 0; i < n; i++) {
vector<pair<int, int>> pq;
for (int j = 0; j < p[i].first; j++) {
pq.push_back({ cnt[j], j });
}
sort(pq.begin(), pq.end());
for (int j = 0; j < p[i].second; j++) {
ans += pq[j].first;
cnt[pq[j].second]++;
}
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
748 KB |
Output is correct |
2 |
Correct |
1 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
748 KB |
Output is correct |
2 |
Correct |
1 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
748 KB |
Output is correct |
2 |
Correct |
1 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
748 KB |
Output is correct |
2 |
Correct |
10 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
342 ms |
1004 KB |
Output is correct |
2 |
Execution timed out |
1060 ms |
1700 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
1460 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1096 ms |
1592 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1056 ms |
1904 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1097 ms |
4116 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1096 ms |
2924 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1098 ms |
2920 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |