QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#392197 | #3788. Funny Car Racing | ucup-team1251 | 0 | 49ms | 12088kb | C++17 | 1.2kb | 2024-04-17 11:14:21 | 2024-04-17 11:14:23 |
Judging History
answer
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<math.h>
#include<set>
#include<bitset>
#include<deque>
#include<unordered_map>
#include<algorithm>
#define int long long
using namespace std;
typedef pair<int,int>PII;
const int N=305,M=5e2+10;
int n,m,x,y;
int dist[305],st[305];
struct le{
int y,a,b,t;
};
vector<le>v[N];
void get(){
priority_queue<int,vector<int>,greater<int>>q;
for(int i=1;i<=n;i++){
dist[i]=1e9,st[i]=0;
}
q.push(x);
dist[x]=0;
while(q.size()){
auto u=q.top();
q.pop();
if(st[u]) continue ;
st[u]=1;
for(int i=0;i<v[u].size();i++){
int oo=v[u][i].y;
int a=v[u][i].a;
int b=v[u][i].b;
int t=v[u][i].t;
int tt=0;
if(a<t) continue ;
if(a>=t){
tt=dist[u]%(a+b);
if(tt>a) tt=a+b-tt+t;
else{
if(tt+t<=a) tt=t;
else if(tt+t<=a+b) tt=a+b-tt+t;
}
}
if(dist[oo]>dist[u]+tt){
dist[oo]=dist[u]+tt;
q.push(oo);
}
}
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie();
cout.tie();
int o=0;
while(cin>>n>>m>>x>>y){
for(int i=1;i<=m;i++){
int u,vv,a,b,t;
cin>>u>>vv>>a>>b>>t;
v[u].push_back({vv,a,b,t});
}
get();
cout<<"Case "<<++o<<": "<<dist[y]<<endl;
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 49ms
memory: 12088kb
input:
155 9507 117 14 19 18 2 123 1 100 97 4 155 3 121 120 1 140 1 5 8 1 121 1 69 66 2 107 2 151 150 2 190 1 68 69 1 101 1 61 60 2 126 1 124 127 2 160 3 59 55 5 133 4 66 67 1 189 1 94 96 2 108 2 65 63 2 181 2 44 48 1 130 1 28 29 1 180 1 5 6 1 107 1 29 28 1 120 1 142 140 4 152 2 46 45 2 113 1 85 88 6 163 3...
output:
Case 1: 565 Case 2: 755 Case 3: 466 Case 4: 144 Case 5: 409 Case 6: 265 Case 7: 248 Case 8: 140 Case 9: 158 Case 10: 1072 Case 11: 1095 Case 12: 167 Case 13: 572 Case 14: 135 Case 15: 560 Case 16: 144 Case 17: 136 Case 18: 118 Case 19: 151 Case 20: 121 Case 21: 722 Case 22: 122 Case 23: 599 Case 24:...
result:
wrong answer 1st lines differ - expected: 'Case 1: 249', found: 'Case 1: 565'