ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#447 | #73. 「NOIP2016」蚯蚓 | Pigsyy | 100 | 2000ms | 61968kb | C++23 | 2.5kb | 2025-04-24 13:40:51 | 2025-04-24 13:40:52 |
answer
#include <bits/stdc++.h>
#define pii pair<long long,long long>
#define mp make_pair
#define pb push_back
using namespace std;
const int MAXSIZE = 1000000;
char buf[MAXSIZE], *p1 = buf + MAXSIZE, *p2 = buf + MAXSIZE;
#define nc() (p1 == p2 && (p1 = buf,fread(buf, 1, MAXSIZE, stdin)),*p1++)
inline long long read() {
long long x = 0;
char ch = nc();
while ('0' > ch || '9' < ch)
ch = nc();
while ('0' <= ch && ch <= '9')
x = x * 10 + (ch ^ 48), ch = nc();
return x;
}
char buf1[MAXSIZE], *p = buf1, *ed = buf1 + MAXSIZE;
#define pc(x) (p==ed&&(p=buf1,fwrite(buf1,1,MAXSIZE,stdout)),*p++)=x
void write(long long x) {
if (x > 9)
write(x / 10);
pc(x % 10 + '0');
}
inline void flush() {
fwrite(buf1, 1, p - buf1, stdout);
p = buf1;
}
long long n, m, q, u, v, t;
int a[100005], b[7200005], c[7200005];
int a1 = 1, b1 = 1, c1 = 1, a2 = 1, b2 = 1, c2 = 1;
const int inf = INT_MAX - 1;
int main() {
// freopen("Worry.in","r",stdin);
// freopen("Worry.out","w",stdout);
n = read();
m = read();
q = read();
u = read();
v = read();
t = read();
for (int i = 1; i <= n; i++) {
a[i] = read();
}
sort(a + 1, a + n + 1);
reverse(a + 1, a + n + 1);
a2 = n + 1;
for (int i = 1; i <= m; i++) {
int ma = -inf, mb = -inf, mc = -inf;
if (a1 != a2)
ma = a[a1];
if (b1 != b2)
mb = b[b1];
if (c1 != c2)
mc = c[c1];
int mx = max(ma, max(mb, mc));
int mx1 = mx + (i - 1) * q;
if (i % t == 0) {
write(mx1);
pc(' ');
}
int t = (u * mx1 / v);
b[b2++] = t - i * q;
c[c2++] = mx1 - t - i * q;
if (ma == mx)
a1++;
else if (mb == mx)
b1++;
else
c1++;
}
pc('\n');
for (int i = 1; i <= n + m; i++) {
int ma = -inf, mb = -inf, mc = -inf;
if (a1 != a2)
ma = a[a1];
if (b1 != b2)
mb = b[b1];
if (c1 != c2)
mc = c[c1];
int mx = max(ma, max(mb, mc));
if (i % t == 0) {
write(mx + m * q);
pc(' ');
}
if (ma == mx)
a1++;
else if (mb == mx)
b1++;
else
c1++;
}
flush();
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 5
Accepted
time: 4ms
memory: 7400kb
input:
1 0 0 1 2 1 915866
output:
915866
result:
ok "915866"
Test #2:
score: 5
Accepted
time: 2ms
memory: 5544kb
input:
1000 0 0 1 2 1 751103 789683 573261 759320 204083 582213 998020 554041 172192 585984 170816 847474 6...
output:
999432 998469 998353 998020 997660 997414 996191 995344 992924 991006 990522 987069 986951 986765 9...
result:
ok 1000 tokens
Test #3:
score: 5
Accepted
time: 24ms
memory: 6244kb
input:
100000 0 0 1 2 1 680351 451124 48910 505493 930478 545620 34252 111923 107488 31506 334922 122964 44...
output:
1000000 999979 999974 999950 999947 999942 999939 999911 999895 999886 999851 999848 999847 999835 ...
result:
ok 100000 tokens
Test #4:
score: 5
Accepted
time: 3ms
memory: 9568kb
input:
1 1000 0 1 2 1 33386
output:
33386 16693 16693 8347 8347 8346 8346 4174 4174 4173 4173 4173 4173 4173 4173 2087 2087 2087 2087 20...
result:
ok 2001 tokens
Test #5:
score: 5
Accepted
time: 6ms
memory: 7420kb
input:
1000 1000 0 1 2 1 132625 572871 770124 563851 578941 933006 37851 712167 787787 21841 604359 544543 ...
output:
999591 998289 992902 992899 990821 988583 987695 987062 984833 983641 982764 979755 979383 978593 97...
result:
ok 3000 tokens
Test #6:
score: 5
Accepted
time: 0ms
memory: 7368kb
input:
1 1000 101 1 2 1 878550
output:
878550 439275 439376 219739 219839 219890 219991 110173 110273 110324 110424 110450 110551 110602 11...
result:
ok 2001 tokens
Test #7:
score: 5
Accepted
time: 1ms
memory: 7420kb
input:
1000 1000 130 1 2 1 719730 265368 766225 978873 180882 759547 799075 652390 846784 103245 459582 527...
output:
998520 998405 998288 997931 996455 995925 995214 994998 994931 993811 993022 991458 990524 989079 98...
result:
ok 3000 tokens
Test #8:
score: 5
Accepted
time: 40ms
memory: 8516kb
input:
50000 50000 0 1 2 1 200240 332901 277204 806517 368526 442028 524956 700364 228807 786932 131910 655...
output:
1000000 999962 999959 999953 999880 999878 999874 999873 999863 999846 999828 999827 999804 999777 9...
result:
ok 150000 tokens
Test #9:
score: 5
Accepted
time: 52ms
memory: 8944kb
input:
100000 100000 0 1 2 2 959613 194150 85516 394977 870052 300505 900903 647300 231641 734416 481762 68...
output:
999965 999954 999910 999900 999866 999862 999813 999794 999781 999764 999758 999725 999718 999714 99...
result:
ok 150000 tokens
Test #10:
score: 5
Accepted
time: 131ms
memory: 26900kb
input:
100000 2000000 0 1 2 21 66589 48392 791767 104800 766778 53663 117659 914981 951118 653732 575320 33...
output:
999864 999634 999499 999270 999104 998913 998716 998530 998331 998147 997897 997696 997453 997192 99...
result:
ok 195238 tokens
Test #11:
score: 5
Accepted
time: 147ms
memory: 29000kb
input:
100000 2500000 0 1 2 26 49672 613410 576709 19013 843381 207064 930756 472514 731146 788207 286649 3...
output:
999693 999361 999115 998848 998660 998487 998209 997983 997697 997494 997266 997001 996696 996437 99...
result:
ok 196153 tokens
Test #12:
score: 5
Accepted
time: 192ms
memory: 37176kb
input:
100000 3500000 0 1 2 36 2926831 7957102 9339535 6140298 9778289 7343914 3819688 3934516 4909839 1447...
output:
9997244 9993812 9990862 9988046 9984114 9979187 9975743 9971851 9967744 9963824 9960344 9957327 9952...
result:
ok 197222 tokens
Test #13:
score: 5
Accepted
time: 263ms
memory: 49404kb
input:
100000 5000000 0 153252866 506034425 51 9865456 7275647 9260296 4104264 5535150 462208 1644763 68910...
output:
9994209 9988048 9983017 9977409 9971961 9966543 9960245 9955426 9950317 9945283 9941161 9936720 9930...
result:
ok 198039 tokens
Test #14:
score: 5
Accepted
time: 361ms
memory: 61968kb
input:
100000 7000000 0 357111899 688810819 71 69584443 17447233 31714022 66332206 64271777 53896834 218916...
output:
99912143 99831664 99762428 99698089 99623075 99550896 99462188 99386381 99299109 99225508 99164639 9...
result:
ok 198591 tokens
Test #15:
score: 5
Accepted
time: 47ms
memory: 9700kb
input:
50000 50000 83 1 2 1 84360021 71347337 39044696 22626429 70396546 40094315 23005735 75656509 7170043...
output:
99998786 99998673 99996873 99994357 99992093 99990524 99990202 99986550 99985362 99980613 99977718 9...
result:
ok 150000 tokens
Test #16:
score: 5
Accepted
time: 61ms
memory: 10872kb
input:
50000 150000 131 1 2 2 20230216 16944549 92292904 97379087 27243476 17669963 70262093 22087930 15981...
output:
99995655 99988697 99984529 99977146 99974971 99966567 99965867 99963568 99961070 99960999 99959482 9...
result:
ok 175000 tokens
Test #17:
score: 5
Accepted
time: 51ms
memory: 10064kb
input:
100000 100000 178 132358018 140364259 3 83072957 5441239 53478006 30551173 88543592 82231284 9362625...
output:
99996327 99993082 99991642 99991386 99990496 99990769 99990699 99987089 99985399 99984658 99983590 9...
result:
ok 99999 tokens
Test #18:
score: 5
Accepted
time: 74ms
memory: 11852kb
input:
100000 300000 92 258729579 850884467 4 41792818 41347297 9862677 26430344 30975686 74655582 35126740...
output:
99995333 99990181 99985754 99982607 99980455 99976678 99970940 99965773 99961646 99955959 99952184 9...
result:
ok 175000 tokens
Test #19:
score: 5
Accepted
time: 202ms
memory: 37272kb
input:
100000 3500000 104 102514430 964087490 36 28839242 27693274 44178102 57443460 77799442 72224991 2775...
output:
99974806 99950998 99916312 99886038 99862310 99823810 99798321 99759808 99722558 99690439 99666640 9...
result:
ok 197222 tokens
Test #20:
score: 5
Accepted
time: 339ms
memory: 61796kb
input:
100000 7000000 67 208233944 504103320 71 7263944 53468728 10518204 48490395 37736986 77899217 303590...
output:
99924577 99856647 99773016 99705429 99634016 99559279 99501349 99436902 99353202 99297141 99224529 9...
result:
ok 198591 tokens