QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#116808 | #149. Peru | He_Ren# | 18 | 1ms | 8048kb | C++17 | 689b | 2023-06-30 08:37:10 | 2024-09-10 16:33:37 |
Judging History
你现在查看的是最新测评结果
- [2024-05-31 18:29:44]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-06-30 08:37:10]
- 提交
answer
#include<bits/stdc++.h>
#include"peru.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 2.5e5 + 5;
const int mod = 1e9 + 7;
const ll linf = 0x3f3f3f3f3f3f3f3f;
int a[MAXN];
int solve(int n, int d, int *_a)
{
for(int i=1; i<=n; ++i)
a[i] = _a[i-1];
static ll f[MAXN];
fill(f+1, f+n+1, linf);
f[0] = 0;
for(int i=1; i<=n; ++i)
{
int cur = 0;
for(int j=i; j>=1 && j>=i-d+1; --j)
{
cur = max(cur, a[j]);
f[i] = min(f[i], f[j-1] + cur);
}
}
int ans = 0, curpw = 1;
for(int i=n; i>=1; --i)
{
ans = (ans + (ll)f[i] %mod * curpw) %mod;
curpw = (ll)curpw * 23 %mod;
}
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 18
Accepted
Test #1:
score: 18
Accepted
time: 0ms
memory: 5864kb
input:
2000 170 1054018657 1037445664 1011691297 1009972317 1006506677 1002579733 999792775 999477541 975467893 970302369 968173111 957735623 953086083 938540451 932313113 930563895 924682633 917831575 913506401 908739591 905368525 899452913 894354220 890127447 885923007 583391543 880642788 878397752 87822...
output:
559335223
result:
ok single line: '559335223'
Test #2:
score: 18
Accepted
time: 0ms
memory: 5932kb
input:
2000 100 1019222751 1012312953 1005125581 978875481 967275037 967176717 965763637 960999157 957233281 956958729 953471924 942217905 936256081 925906257 922808341 918616993 918132100 915435367 911342035 909313549 902957201 902119531 900836861 99996937 892982026 884892282 884816596 884102145 883049077...
output:
818524087
result:
ok single line: '818524087'
Test #3:
score: 18
Accepted
time: 0ms
memory: 7920kb
input:
2000 20 1046023457 988320769 85389793 1819030505 635209701 362287065 747208901 958302681 957423952 1241659175 352880697 545051421 356189641 1678485313 76683576 940812217 995748541 1920846205 80556065 1358698601 483048309 1881187901 639822057 873315653 1157374529 225761262 1271878801 421346861 190846...
output:
722220390
result:
ok single line: '722220390'
Test #4:
score: 18
Accepted
time: 1ms
memory: 5808kb
input:
2000 30 1742393521 1373505943 1783981533 969067201 1868827930 1242849529 340585550 1430285741 1467707069 931245518 1652549049 1531083137 590083361 1624545751 90840583 920774329 1130261561 452306243 19102491 955643121 258267441 923161989 534143934 856297743 279514021 503065922 409174401 432771113 120...
output:
650653589
result:
ok single line: '650653589'
Test #5:
score: 18
Accepted
time: 1ms
memory: 8048kb
input:
2000 50 543424081 894641096 1339301255 1889686701 952129633 612233257 1547586801 364344001 432571137 1050383003 1137993587 685296321 666004060 67614961 585732097 121629576 1975355921 1465203126 1904792785 466104889 1562726309 1291336401 1942673537 1075318749 740251709 1038567681 1408927717 178247074...
output:
925458417
result:
ok single line: '925458417'
Test #6:
score: 18
Accepted
time: 1ms
memory: 5776kb
input:
2000 66 296941975 632767915 1762639311 958786399 1071923265 1552982561 216785941 1887579821 509308881 435656001 390210676 197780151 1301996771 1489698520 141918911 891666845 574475831 899508601 1013449051 175378801 89348801 837595313 270629113 279029177 384317601 1755443841 1235606561 1547972848 202...
output:
444646258
result:
ok single line: '444646258'
Test #7:
score: 18
Accepted
time: 1ms
memory: 5848kb
input:
2000 40 1059696721 1055166157 1044539161 1034355529 1030533441 1025978401 995197251 994572517 973608392 973353991 964014126 378408808 958025513 951750766 951037371 949770821 948486985 941198116 933949689 929560654 929512513 921764609 921307889 921167577 920417481 911390897 910270385 906125481 895972...
output:
7677983
result:
ok single line: '7677983'
Test #8:
score: 18
Accepted
time: 1ms
memory: 7976kb
input:
2000 20 1055110455 1005223324 1003873357 993841570 85534741 978021371 972929053 965514337 956876706 954140500 953747239 947700853 944007670 941645514 940364189 927465533 927214939 922020939 921390841 916331914 912757594 44655871 910441087 908052421 906270473 44773462 906022207 904501165 902742688 90...
output:
505871513
result:
ok single line: '505871513'
Test #9:
score: 18
Accepted
time: 1ms
memory: 5848kb
input:
2000 35 1022691767 1014414743 1011271745 1004244164 997794327 993850701 989771077 987749281 983716200 972060987 970129801 970068556 965852449 958249651 487933 958036353 956471803 948960379 948894321 948793357 947237281 130227931 937986316 937272479 932507293 932399201 928000385 27050453 922445926 92...
output:
211950235
result:
ok single line: '211950235'
Test #10:
score: 18
Accepted
time: 0ms
memory: 5804kb
input:
2000 50 1151914561 1495201451 1012909476 272883901 1725748641 950389217 206580001 1347030801 1931958771 1366894201 1250674465 1396662273 1905672559 1814735325 153639169 1199502271 1743930753 507709292 355904698 402770401 350650585 721029217 40258129 1743270991 207229381 435727781 1221323521 64386688...
output:
229458181
result:
ok single line: '229458181'
Test #11:
score: 18
Accepted
time: 1ms
memory: 5804kb
input:
2000 34 874023147 734709909 335190475 999498237 1581908993 272842689 1541974929 603853521 1502263105 1523850553 437313251 605618113 1252482079 1917808729 1839292253 1153661850 1768401651 970691571 296972777 1794594401 1898042336 1017506001 970010409 135942787 960588801 1817971441 1261276641 19492460...
output:
459414440
result:
ok single line: '459414440'
Test #12:
score: 18
Accepted
time: 0ms
memory: 7888kb
input:
2000 90 1945282221 581009181 63394299 627330027 1286388499 1097696131 1076306649 1761841621 1746358081 365563062 154009661 1801265786 1529431757 122058697 1381712677 411146001 1981007576 1167570621 1407588502 446110641 1597208705 414478041 1157817065 1614045761 1583648801 1166985591 1090632001 14515...
output:
198932165
result:
ok single line: '198932165'
Test #13:
score: 18
Accepted
time: 1ms
memory: 7896kb
input:
2000 101 1199509006 1918260001 1593549901 350489646 136788141 653292001 496126267 1074488441 184087969 697990641 1683056858 1992780276 705314881 403401873 771792621 236609025 1864750009 1505559241 1999940279 669693349 56972501 157466251 379727249 1265769875 347490626 1105199127 485967826 803890001 1...
output:
774419684
result:
ok single line: '774419684'
Test #14:
score: 18
Accepted
time: 0ms
memory: 5932kb
input:
2000 15 1689537321 898720501 1669337777 128316734 1978406108 1147164161 577488769 1844956801 1404644001 421025281 476255243 599476829 665843745 980993826 1894059905 152672733 330694871 1001232741 794930081 851019681 1611922961 1298969774 1580535251 1440923521 1225542751 1577310513 37273681 180104705...
output:
373845090
result:
ok single line: '373845090'
Subtask #2:
score: 0
Runtime Error
Test #15:
score: 0
Runtime Error
input:
400000 1000 1999989721 1999987224 1999984551 1999977673 1999977545 1999976801 1999975837 1999972607 1999956301 1999952801 1999942489 1999940593 1999940337 1999936353 1999936273 1999926073 1999925513 1999922980 1999918301 1999912501 1999909301 1999906125 1999902913 1999895622 1999893617 1999885490 19...
output:
result:
Subtask #3:
score: 0
Runtime Error
Test #34:
score: 0
Runtime Error
input:
2500000 2000 1073315871 1073250349 1072791751 1072104046 1072071097 1071841833 1071809381 1071710686 1071580105 1071482003 1071383725 1071154701 1070499431 1070335288 1070334157 1069943617 1069681476 1069584279 1069581771 1069322519 1069189353 1069125955 1068832186 1068797487 1068662939 1068565681 1...