QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#766960 | #3502. Sightseeing in Kyoto | QOJ114514ancestor | 10 | 5ms | 11600kb | C++14 | 427b | 2024-11-20 19:26:32 | 2024-11-20 19:26:33 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define N 1005
using namespace std;
int n,m,a[N],b[N],f[N][N];
signed main(){
cin>>n>>m;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=m;i++)cin>>b[i];
for(int i=1;i<=n;i++)
for(int j=1+(i==1);j<=m;j++){
f[i][j]=1e18;
if(i>=2)f[i][j]=min(f[i][j],f[i-1][j]+b[j]);
if(j>=2)f[i][j]=min(f[i][j],f[i][j-1]+a[i]);
}
cout<<f[n][m]<<'\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 6028kb
input:
55 985 972919143 571703632 545299240 122906268 313605426 768197556 821161013 810382136 607096032 550926769 636584830 233641411 664075312 999513344 919939491 226167158 374405025 792842315 461126245 212582686 538315759 397667313 770583715 411616307 363120565 690544971 780156662 507283838 215368652 461...
output:
144700753486
result:
ok single line: '144700753486'
Test #2:
score: 10
Accepted
time: 1ms
memory: 7856kb
input:
489 2 972249103 697236949 967250764 681884473 636477380 692387561 796114900 896503411 763037576 531113684 822189792 807721830 379742704 846345706 410827375 402701704 288551124 936639599 375887198 452684376 312984818 244195135 486887067 586097199 539831363 306788937 900402922 677824462 416376869 3759...
output:
328323599204
result:
ok single line: '328323599204'
Test #3:
score: 10
Accepted
time: 1ms
memory: 6576kb
input:
323 8 945461002 972239828 497762984 785301370 848811267 781893207 883500216 606146710 897537367 693757813 773725023 641896522 644191887 883063599 971678650 612626656 627975243 513682284 958238083 481331187 448598476 690397378 810919101 466228458 520809215 642288505 459053386 425488261 729532078 5456...
output:
131909604852
result:
ok single line: '131909604852'
Test #4:
score: 10
Accepted
time: 0ms
memory: 5884kb
input:
211 6 300121025 10610632 642793775 820473527 52357847 790030800 930189727 478683824 604076353 442883453 868963075 458740167 956375465 402424884 523031876 526153589 125251913 93824897 767836934 456717799 932696378 585279523 565442853 533089757 384029723 733772180 715451948 677398582 104677992 1442538...
output:
24939943080
result:
ok single line: '24939943080'
Test #5:
score: 10
Accepted
time: 0ms
memory: 3680kb
input:
7 8 324438357 888585680 228658980 633680643 553949653 919446743 26789616 733732803 467151303 946129278 774855331 974783731 656427372 391841553 441397515
output:
3288083871
result:
ok single line: '3288083871'
Test #6:
score: 10
Accepted
time: 2ms
memory: 11532kb
input:
1000 1000 974951229 572812767 61715338 58251108 992970132 292320832 346580154 883002624 576964058 294430934 705885668 17573757 290787136 184748452 110588470 132698209 364284483 39793402 636955202 414014896 895716291 779502490 194065320 111799307 938923636 424807575 673188421 208882345 776527514 4149...
output:
8615286430
result:
ok single line: '8615286430'
Test #7:
score: 10
Accepted
time: 5ms
memory: 11600kb
input:
1000 1000 463735528 368326134 677560869 451081556 375842266 6384404 536728283 244288194 174615742 832350611 90313025 745365715 317800980 757018742 59003470 726586504 81229973 820301929 811995855 239454819 222869219 493887906 769117768 552617574 531399848 885949545 902075394 979715180 256501297 45972...
output:
4777185504
result:
ok single line: '4777185504'
Test #8:
score: 10
Accepted
time: 2ms
memory: 11396kb
input:
1000 1000 883558431 945024329 580084906 610495543 886627709 672002744 741096827 470027044 470962281 937891177 847981533 824554158 602335507 876759099 523261283 694326120 436583501 535422997 890070814 954622521 949644535 824717715 640832038 921176755 926409841 980396946 498467817 837955947 770709901 ...
output:
340059299828
result:
ok single line: '340059299828'
Test #9:
score: 10
Accepted
time: 4ms
memory: 11524kb
input:
1000 1000 592192250 845606062 666956702 816157461 468366449 559442281 532323468 464683110 706681121 797732795 733235302 392399774 447221439 492764524 792592254 708344621 609221277 466203011 975765420 657923730 751157743 621708893 455014240 952187591 329055055 718233689 630169159 765083206 604898721 ...
output:
154219020675
result:
ok single line: '154219020675'
Test #10:
score: 10
Accepted
time: 4ms
memory: 11456kb
input:
1000 1000 1000000000 994038761 988095344 982169748 976261973 970372020 964499888 958645578 952809088 946990421 941189574 935406549 929641345 923893963 918164401 912452662 906758743 901082646 895424370 889783916 884161283 878556471 872969481 867400312 861848964 856315437 850799732 845301849 839821786...
output:
352472454089
result:
ok single line: '352472454089'
Test #11:
score: 10
Accepted
time: 4ms
memory: 11392kb
input:
1000 1000 771979348 809794477 694390926 730828708 688658574 954342515 949737702 941901614 601396413 891027684 669526674 505558540 795612501 827513438 805528270 497846784 950599319 750972320 702762085 749933401 496071148 638780364 687373272 785163707 946347808 889047474 839522833 574600817 549625195 ...
output:
210598139296
result:
ok single line: '210598139296'
Test #12:
score: 10
Accepted
time: 0ms
memory: 11528kb
input:
1000 1000 678671204 736484989 636124998 765249579 785794536 766786747 687676825 994297449 588604670 915236809 883080964 866171198 716853010 916987426 761166983 861663197 988771987 811184042 677468802 547964352 770770731 968682653 861745977 903477157 864524565 568472674 890799039 692561891 487676830 ...
output:
184261835444
result:
ok single line: '184261835444'
Test #13:
score: 10
Accepted
time: 4ms
memory: 11396kb
input:
1000 1000 1000000000 995348837 990697674 986046511 981395348 976744186 972093023 967441860 962790697 958139534 953488372 948837209 944186046 939534883 934883720 930232558 925581395 920930232 916279069 911627907 906976744 902325581 897674418 893023255 888372093 883720930 879069767 874418604 869767441...
output:
625000001373
result:
ok single line: '625000001373'
Test #14:
score: 10
Accepted
time: 5ms
memory: 11512kb
input:
1000 1000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000...
output:
1998000000000
result:
ok single line: '1998000000000'
Subtask #2:
score: 0
Wrong Answer
Test #15:
score: 0
Wrong Answer
time: 0ms
memory: 7724kb
input:
307 1278 1000 991 983 975 967 959 952 944 936 928 920 913 905 897 889 882 874 867 859 852 844 837 829 822 815 808 800 793 786 779 772 764 757 750 743 736 730 723 716 709 702 695 689 682 675 669 662 655 649 642 636 630 623 617 610 604 598 592 585 579 573 567 561 555 549 543 537 531 525 519 514 508 50...
output:
189258
result:
wrong answer 1st lines differ - expected: '277650', found: '189258'
Subtask #3:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%