QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#225299 | #3095. Escape Route | zhouhuanyi | 5 | 6616ms | 171012kb | C++23 | 2.0kb | 2023-10-24 13:59:21 | 2023-10-24 13:59:22 |
Judging History
answer
#include"escape_route.h"
#include<iostream>
#include<cstdio>
#include<cmath>
#define SN 90
#define SM 3000000
using namespace std;
const long long inf=(long long)(1e18);
struct reads
{
int num;
long long data;
};
vector<reads>st[SN+1][SN+1];
long long tS,ans[SM+1],dis[SN+1],cst[SN+1][SN+1],leng[SN+1][SN+1];
bool used[SN+1][SN+1],vis[SN+1];
int n;
long long F(int x,int y,long long t)
{
int rt;
long long minn;
for (int i=1;i<=n;++i) dis[i]=inf,vis[i]=0;
dis[x]=t;
for (int i=1;i<=n;++i)
{
minn=inf;
for (int j=1;j<=n;++j)
if (!vis[j]&&dis[j]<minn)
rt=j,minn=dis[j];
vis[rt]=1;
for (int j=1;j<=n;++j)
if (used[rt][j])
{
if (minn%tS<=cst[rt][j]-leng[rt][j]) dis[j]=min(dis[j],minn+leng[rt][j]);
else dis[j]=min(dis[j],(minn/tS+1)*tS+leng[rt][j]);
}
}
return dis[y]-t;
}
void solve(int x,int y,long long l,long long r,long long L,long long R,vector<reads>p)
{
if (p.empty()) return;
if (L==R)
{
for (int i=0;i<p.size();++i) ans[p[i].num]=L;
return;
}
long long mid=(l+r)>>1,d=F(x,y,mid),d2=F(x,y,mid+1);
vector<reads>A;
vector<reads>B;
for (int i=0;i<p.size();++i)
{
if (p[i].data<=mid) A.push_back(p[i]);
else B.push_back(p[i]);
}
solve(x,y,l,mid,L,d,A),solve(x,y,mid+1,r,d2,R,B);
return;
}
vector<long long>calculate_necessary_time(int N,int M,long long S,int Q,vector<int>A,vector<int>B,vector<long long>L,vector<long long>C,vector<int>U,vector<int>V,vector<long long>T)
{
int rt;
long long minn,t;
vector<long long>p;
n=N,tS=S;
for (int i=1;i<=M;++i) A[i-1]++,B[i-1]++,used[A[i-1]][B[i-1]]=used[B[i-1]][A[i-1]]=1,cst[A[i-1]][B[i-1]]=cst[B[i-1]][A[i-1]]=C[i-1],leng[A[i-1]][B[i-1]]=leng[B[i-1]][A[i-1]]=L[i-1];
for (int i=1;i<=Q;++i) U[i-1]++,V[i-1]++,st[U[i-1]][V[i-1]].push_back((reads){i,T[i-1]});
for (int i=1;i<=n;++i)
for (int j=1;j<=n;++j)
solve(i,j,0,S-1,F(i,j,0),F(i,j,S-1),st[i][j]);
for (int i=1;i<=Q;++i) p.push_back(ans[i]);
return p;
}
詳細信息
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 27ms
memory: 67644kb
input:
20 25 1000000000 1000 19 14 90509532 395178972 6 12 52555823 230197434 9 6 41978234 90329771 6 18 8293185 824071496 0 13 35999620 908026854 2 18 17143126 46209532 17 8 2146423 625200489 3 7 22505966 277897576 7 16 95978223 450666887 5 18 22992288 305443621 13 3 54291836 100388711 13 15 14415203 8317...
output:
480557149 731813221 531968775 431599596 694448121 715925162 692048139 374020064 35999620 419096231 298628112 358760644 169005469 851402422 930706705 525115250 448178961 167407909 675296534 360680519 728933035 173728392 490870115 131283187 493383137 227201702 252283621 521737971 378591732 270841294 3...
result:
ok 1000 lines
Test #2:
score: 0
Accepted
time: 129ms
memory: 67836kb
input:
40 200 1000000000 1000 10 2 734781948 757935316 36 6 759292837 905833388 24 9 753749445 971917398 17 33 259026695 506429162 28 31 679388590 994354060 19 14 625424961 931267925 32 20 754984385 828082800 21 30 798214388 889219063 21 8 575895801 815891266 22 14 19977414 765646895 32 27 30997595 9580798...
output:
304770024 1198101026 838497030 691246560 690297559 1536285219 367578352 210764961 808494307 545359063 1113731535 415653679 821510393 398775859 405908842 844751310 1712896683 703741339 871444833 738442204 1170213833 866113717 1042863220 827711740 376924935 1723226335 774412758 688778769 1358563872 10...
result:
ok 1000 lines
Test #3:
score: 0
Accepted
time: 136ms
memory: 67816kb
input:
40 780 1000000000000000 1000 38 10 82663889339337 350145674812417 0 38 45656620817796 341033443803535 27 36 27849702108152 574261559900190 15 25 72379996614905 76902806764481 37 26 40536321043928 644931472366366 3 14 84348073841713 419662726942159 1 2 83025674827405 397052624598278 31 38 26738085853...
output:
24127227436749 46343217311480 19435698740204 95591007552677 48126521707264 15355593649406 17591255715335 8193651832239 11679896494522 37940180527687 16215881045386 17030955993658 17310217429720 39288517367523 11592766532561 27468562431861 16636196850396 44138490445052 14285030536879 10040014357057 1...
result:
ok 1000 lines
Test #4:
score: 0
Accepted
time: 3ms
memory: 67868kb
input:
2 1 1000000000000000 1000 1 0 296548286231444 662656127488519 0 1 423512843106918 1 0 782529741840129 0 1 112136122289856 0 1 131199945009194 0 1 684150694909952 0 1 681984372214770 0 1 837419574094320 0 1 923388997685299 0 1 544265818903610 0 1 676542806266635 0 1 559597760476793 1 0 44928100529934...
output:
873035443124526 514018544391315 296548286231444 296548286231444 612397591321492 614563914016674 459128712137124 373159288546145 752282467327834 620005479964809 736950525754651 847267280932097 747972135452334 612107081097755 928500439905186 410146705855084 296548286231444 416002119276353 296548286231...
result:
ok 1000 lines
Test #5:
score: 0
Accepted
time: 30ms
memory: 67660kb
input:
40 750 2 1000 22 17 1 1 32 2 1 1 10 24 1 1 15 26 1 1 28 20 1 1 16 32 1 1 20 9 1 1 0 28 1 1 20 36 1 1 21 26 1 1 36 7 1 1 8 18 1 1 38 3 1 1 15 0 1 1 22 15 1 1 3 0 1 1 3 29 1 1 33 29 1 1 19 13 1 1 15 3 1 1 19 27 1 1 18 5 1 1 21 7 1 1 32 12 1 1 22 5 1 1 39 32 1 1 12 39 1 1 33 8 1 1 2 22 1 1 39 30 1 1 20...
output:
1 2 2 2 2 1 2 1 4 2 1 2 2 2 2 2 1 1 2 2 1 1 1 2 1 1 2 2 1 2 2 1 1 2 1 2 1 1 2 2 3 2 2 2 2 1 1 2 1 2 1 1 1 2 2 3 2 1 1 2 1 3 2 2 1 2 1 2 1 1 2 1 2 2 1 3 2 1 2 1 3 2 1 1 1 1 2 2 1 1 1 2 1 1 2 1 1 2 1 2 1 1 1 1 1 2 2 1 2 1 2 2 2 2 3 1 2 1 4 2 2 2 2 1 1 1 2 1 2 2 2 1 2 2 2 1 1 1 2 2 2 1 1 2 1 1 1 2 2 1 ...
result:
ok 1000 lines
Test #6:
score: 0
Accepted
time: 207ms
memory: 67612kb
input:
40 45 1000000000000000 1000 7 36 610946680675912 704268062671912 9 36 893134514126996 972904777784738 12 26 657198258974015 948451434143784 8 1 552477615483120 765425674169417 26 22 495211770416996 877269866223824 21 11 511488412530216 670637740166672 16 14 996077136723057 999869034259267 8 37 99774...
output:
4949145719753097 3539932959210141 5326479671991186 3900639332144229 2066799688102953 2331964491048397 6154667293624942 3682209360972239 3030032742449401 2341861193751505 5261392934510340 4748518937830088 4712075400553459 4355166166512183 2733978529296229 2430943604048880 3603603454872421 32166181523...
result:
ok 1000 lines
Subtask #2:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 6616ms
memory: 171012kb
input:
40 780 1000000000 3000000 35 37 7260282 695891301 0 29 4 333333333 31 34 1966 107334225 30 21 9922473 991394502 21 23 6724109 636376098 4 20 8364 818222403 12 9 9039 893222328 12 15 8446144 827521983 17 1 1914 101556453 2 4 3 222222222 2 8 9302 922444521 38 29 7432469 715004058 16 30 8 777777777 20 ...
output:
5293312 8550127 5933791 1709359 4873362 7000678 6534887 2459391 2278979 8868723 4094394 1469 5507172 7492652 9410783 6410291 2281445 3780932 5843741 2164508 2293384 2899495 5753560 9276230 8451884 1674489 6985985 4094352 8464070 1839644 7392412 3693062 6114545 2637695 5097914 2670052 8638516 2278970...
result:
wrong answer 185th lines differ - expected: '19363', found: '9'
Subtask #3:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%