# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
667294 |
2022-12-01T04:36:40 Z |
raypeng1729 |
Sails (IOI07_sails) |
C++17 |
|
22 ms |
3668 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e16;
signed main(){
ios::sync_with_stdio(false), cin.tie(0);
int n; cin >> n;
int a[n], b[n], mx = 0;
for(int i = 0; i < n; i++) cin >> a[i] >> b[i], mx = max(mx, a[i]);
int pre[mx + 1]{};
for(int i = 0; i < n; i++){
pre[0]++, pre[a[i] + 1]--;
}
for(int i = 1; i <= mx; i++) pre[i] += pre[i - 1];
int ans = 0, cnt = accumulate(b, b + n, 0);
ans -= cnt;
for(int i = mx; i > 0; i--){
int cur = min(pre[i], cnt / i);
ans += cur * cur;
cnt -= cur;
}
cout << ans / 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
224 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
356 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
712 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
1352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
1980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
3020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
3492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
3668 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |