ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#214531 | #574. t3 | huangyuhe | 100 | 1442ms | 2116kb | C++11 | 727b | 2024-11-19 21:07:08 | 2024-11-19 23:02:33 |
answer
#include <bits/stdc++.h>
#define C__ const
#define int long long
using namespace std;
C__ int N_ = 1e5 + 10;
int n, x, y, z, a[N_];
signed main() {
cin >> n >> x >> y >> z;
for (int i = 1; i <= n; i++) {
int u, v;
cin >> u >> v;
a[i] = v - u;
}
priority_queue<int, vector<int>, greater<int> > que1, que2;
int ans = 0;
for (int i = 1; i <= n; i++) {
while (a[i] > 0) {
int v = x;
if (!que2.empty()) v = min(v, i * z + que2.top()), que2.pop();
ans += v, --a[i], que1.push(- i * z - v);
}
while (a[i] < 0) {
int v = y;
if (!que1.empty()) v = min(v, i * z + que1.top()), que1.pop();
ans += v, ++a[i], que2.push(- i * z - v);
}
}
cout << ans << "\n";
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 30
Accepted
Test #1:
score: 30
Accepted
time: 0ms
memory: 1260kb
input:
50 4 401 83 1 9 0 10 1 1 7 5 6 2 6 10 5 10 5 5 4 4 10 8 8 3 4 8 8 0 1 2 8 9 9 9 4 6 8 7 3 10 2 4 9 3...
output:
12399
result:
ok "12399"
Test #2:
score: 0
Accepted
time: 1ms
memory: 1260kb
input:
50 1811 650 156 6 5 3 1 0 9 0 0 1 0 0 7 1 10 10 3 8 10 5 9 8 6 2 9 1 4 0 9 2 9 9 3 2 3 5 2 4 6 1 2 9...
output:
85235
result:
ok "85235"
Test #3:
score: 0
Accepted
time: 0ms
memory: 1252kb
input:
50 3618 899 582 1 2 5 3 10 7 3 6 6 9 5 4 7 10 4 0 1 4 1 9 8 9 10 10 6 9 0 5 6 9 9 8 0 10 1 8 6 2 0 1...
output:
253368
result:
ok "253368"
Test #4:
score: 0
Accepted
time: 0ms
memory: 1256kb
input:
50 425 1148 8 6 9 8 5 10 4 6 0 0 7 10 0 3 0 9 9 5 10 7 9 8 1 8 0 10 3 10 1 10 9 9 3 8 6 8 3 7 8 10 7...
output:
65368
result:
ok "65368"
Test #5:
score: 0
Accepted
time: 1ms
memory: 1260kb
input:
50 2232 2750 434 1 6 0 7 9 1 9 6 6 5 4 8 9 0 3 7 9 5 2 10 9 5 5 1 3 7 9 8 3 8 9 8 6 3 4 9 9 4 9 4 10...
output:
121406
result:
ok "121406"
Test #6:
score: 0
Accepted
time: 0ms
memory: 1256kb
input:
50 4039 2999 507 6 2 3 9 8 10 1 0 0 4 9 5 5 0 8 4 2 10 9 10 9 8 3 2 8 1 9 4 8 8 9 2 4 10 1 4 0 0 8 2...
output:
224049
result:
ok "224049"
Test #7:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
50 846 3248 933 1 10 5 10 8 7 4 6 6 2 3 2 0 0 2 2 6 5 4 0 9 0 0 3 1 5 8 0 1 8 9 7 1 6 8 10 1 7 7 10 ...
output:
174023
result:
ok "174023"
Test #8:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
50 2653 3497 359 6 6 8 1 7 4 7 1 0 0 8 10 7 1 7 10 10 10 10 0 9 3 9 4 6 10 7 7 5 8 9 2 10 3 4 5 3 2 ...
output:
330818
result:
ok "330818"
Test #9:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
50 4460 3746 785 1 3 0 3 6 2 10 6 6 9 2 7 2 1 1 8 3 5 6 0 9 6 6 4 10 4 7 3 9 7 9 7 8 10 0 0 5 9 6 4 ...
output:
203160
result:
ok "203160"
Test #10:
score: 0
Accepted
time: 0ms
memory: 1260kb
input:
50 1267 3995 858 6 10 3 5 6 10 2 1 0 7 7 4 9 1 6 6 7 0 1 1 9 9 4 5 3 8 6 0 3 7 9 1 5 7 8 6 6 5 5 2 0...
output:
221209
result:
ok "221209"
Subtask #2:
score: 30
Accepted
Test #11:
score: 30
Accepted
time: 81ms
memory: 2100kb
input:
100000 100000000 100000000 1 4 1 7 1 7 6 7 5 7 5 6 6 5 1 1 4 2 0 3 0 5 7 1 9 1 1 6 8 2 5 7 7 7 9 6 3...
output:
211716275189
result:
ok "211716275189"
Test #12:
score: 0
Accepted
time: 84ms
memory: 2088kb
input:
100000 100000000 100000000 1 3 2 6 7 3 8 9 4 5 8 1 0 4 6 9 0 2 5 1 4 0 2 2 9 5 10 7 1 6 4 3 0 7 9 1 ...
output:
146913863207
result:
ok "146913863207"
Test #13:
score: 0
Accepted
time: 84ms
memory: 2072kb
input:
100000 100000000 100000000 1 2 2 5 1 0 0 0 4 2 0 7 6 2 0 6 6 2 10 10 8 5 9 2 9 8 7 8 5 0 4 10 4 6 9 ...
output:
125015898506
result:
ok "125015898506"
Test #14:
score: 0
Accepted
time: 81ms
memory: 2100kb
input:
100000 100000000 100000000 1 1 3 5 7 7 3 2 3 10 3 1 0 0 5 3 2 3 4 7 1 0 4 3 9 0 5 9 10 4 3 6 9 6 9 0...
output:
306911415038
result:
ok "306911415038"
Test #15:
score: 0
Accepted
time: 78ms
memory: 2096kb
input:
100000 100000000 100000000 1 0 4 4 1 4 6 4 2 8 6 7 6 9 10 0 8 3 9 5 5 5 10 3 9 3 2 10 3 9 2 2 2 6 9 ...
output:
83822988893
result:
ok "83822988893"
Test #16:
score: 0
Accepted
time: 78ms
memory: 2092kb
input:
100000 100000000 100000000 1 10 5 3 7 0 9 6 2 5 9 2 0 7 4 8 3 3 3 2 8 0 6 3 9 6 10 0 7 3 2 9 6 5 9 0...
output:
17837967511
result:
ok "17837967511"
Test #17:
score: 0
Accepted
time: 83ms
memory: 2112kb
input:
100000 100000000 100000000 1 9 6 2 1 8 0 8 1 2 2 7 6 5 9 5 10 4 8 0 1 6 1 4 9 9 8 1 1 7 1 5 10 5 9 5...
output:
146418351385
result:
ok "146418351385"
Test #18:
score: 0
Accepted
time: 78ms
memory: 2084kb
input:
100000 100000000 100000000 1 8 7 2 7 4 3 10 0 0 5 2 0 4 3 2 5 4 2 9 5 0 7 4 9 2 5 2 5 1 0 1 4 5 9 10...
output:
84017584381
result:
ok "84017584381"
Test #19:
score: 0
Accepted
time: 82ms
memory: 2080kb
input:
100000 100000000 100000000 1 7 8 1 1 0 6 1 0 8 8 7 6 2 8 10 1 4 7 6 9 6 3 5 10 5 3 3 9 5 0 8 8 5 8 4...
output:
18421668749
result:
ok "18421668749"
Test #20:
score: 0
Accepted
time: 75ms
memory: 2080kb
input:
100000 100000000 100000000 1 6 8 0 7 8 9 3 10 5 0 2 0 0 2 7 7 5 1 4 2 0 9 5 10 8 0 3 3 10 10 4 1 4 8...
output:
71718994500
result:
ok "71718994500"
Subtask #3:
score: 40
Accepted
Test #21:
score: 40
Accepted
time: 76ms
memory: 2072kb
input:
100000 30694440 93757838 144 1 4 0 5 9 3 3 8 6 9 7 4 3 5 6 1 6 6 4 5 10 0 9 4 7 4 9 1 5 4 8 4 2 0 10...
output:
11782941072
result:
ok "11782941072"
Test #22:
score: 0
Accepted
time: 51ms
memory: 2100kb
input:
100000 13169689 16407911 951 7 1 3 7 9 0 6 2 0 7 1 0 9 5 0 10 10 1 0 6 10 3 6 5 0 8 8 8 9 4 8 9 10 7...
output:
66599332884
result:
ok "66599332884"
Test #23:
score: 0
Accepted
time: 50ms
memory: 2116kb
input:
100000 95644938 91574337 758 2 8 6 9 8 8 9 8 6 5 6 8 5 6 5 8 3 6 6 6 10 6 4 6 5 2 8 4 3 4 8 4 8 3 3 ...
output:
82965110631
result:
ok "82965110631"
Test #24:
score: 0
Accepted
time: 51ms
memory: 2104kb
input:
100000 78120187 66740763 565 7 5 9 0 7 5 1 3 0 4 0 5 0 6 10 5 7 1 1 7 10 9 1 7 9 6 7 0 7 3 8 9 6 0 1...
output:
35524028010
result:
ok "35524028010"
Test #25:
score: 0
Accepted
time: 50ms
memory: 2100kb
input:
100000 60595436 41907189 372 2 1 1 2 6 3 4 8 6 2 5 2 7 6 4 3 0 6 8 7 10 2 10 8 2 0 6 7 0 3 8 3 3 7 6...
output:
77303496819
result:
ok "77303496819"
Test #26:
score: 0
Accepted
time: 81ms
memory: 2084kb
input:
100000 43070685 64557262 179 7 9 3 4 6 0 7 3 0 0 10 10 2 7 9 1 4 1 3 7 10 5 7 9 7 4 6 3 4 3 8 8 1 3 ...
output:
57824985320
result:
ok "57824985320"
Test #27:
score: 0
Accepted
time: 79ms
memory: 2088kb
input:
100000 25545934 39723688 986 2 5 6 6 5 8 10 8 6 9 4 7 9 7 3 9 8 6 9 8 10 8 5 10 0 9 5 10 9 3 8 3 10 ...
output:
42292679046
result:
ok "42292679046"
Test #28:
score: 0
Accepted
time: 79ms
memory: 2108kb
input:
100000 60537536 14890114 793 7 2 9 7 4 6 2 3 0 7 8 4 4 7 8 7 1 1 4 8 10 0 2 0 4 3 4 6 2 2 8 8 7 7 6 ...
output:
45040697924
result:
ok "45040697924"
Test #29:
score: 0
Accepted
time: 77ms
memory: 2092kb
input:
100000 25488034 12706613 407 7 6 3 0 3 0 8 3 0 4 7 9 6 8 7 2 9 1 6 9 10 6 8 2 2 1 3 9 10 2 8 7 3 0 9...
output:
57925341606
result:
ok "57925341606"
Test #30:
score: 0
Accepted
time: 42ms
memory: 2072kb
input:
100000 7963283 87873039 214 2 2 6 2 2 9 0 9 5 2 1 6 2 8 1 0 1 7 1 9 10 10 6 2 6 5 2 5 4 2 8 2 0 7 6 ...
output:
83824996000
result:
ok "83824996000"