QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#391649#3788. Funny Car Racingucup-team12510 54ms31960kbC++171.8kb2024-04-16 17:56:192024-04-16 17:56:19

Judging History

你现在查看的是最新测评结果

  • [2024-04-16 17:56:19]
  • 评测
  • 测评结果:0
  • 用时:54ms
  • 内存:31960kb
  • [2024-04-16 17:56:19]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define lson k << 1
#define rson (k << 1) | 1
#define debug cout << 666 << endl;
using namespace std;
const int N = 1e6 + 5;
int a[5][20];
int st[N];
int x, y;
typedef pair<int,int>PII;
typedef array<int,3>ar;
typedef array<int,4>ar4;
vector<ar4>E[N];
int dis[N];
int n,m;
int cn=0;
void dij(int s)
{
    for(int i=1;i<=n;i++) dis[i]=1e18,st[i]=0;
    priority_queue<PII,vector<PII>,greater<PII> >q;
    q.push({0,s});
    dis[s]=0;
    while(q.size()!=0)
    {
        auto P=q.top();
        q.pop();
        int u=P.second;
        if(st[u]==1) continue;
        st[u]=1;
        for(auto V:E[u])
        {
            int w=V[3];
            int v=V[0];
            int a=V[1];
            int b=V[2];
            int now=(dis[u])%(a+b);
            if(w>a) continue;
            int dti=0;
            if(now>a)
            {
                dti=a+b-now+1;
                dti+=w;
            }
            else 
            {
                int ne=a-now;
                if(w>ne)
                {
                    dti=ne+b+w;
                }
                else dti=w;
            }
            if(dis[v]>dis[u]+dti)
            {
                dis[v]=dis[u]+dti;
                q.push({dis[v],v});
            }
        }
    }
}
void vision()
{
    int s,t;
    while (cin >> n >> m>>s>>t)
    {
        for(int i=1;i<=m;i++)
        {
            int u,v,w,a,b;
            cin>>u>>v>>a>>b>>w;
            E[u].push_back({v,a,b,w});
            E[v].push_back({u,a,b,w});
        }
        dij(s);
        cout<<"Case "<<++cn<<": ";
        cout<<dis[t]<<"\n";
        for(int i=1;i<=n;i++) E[i].clear();
    }
    return;
}
signed main()
{
     ios_base::sync_with_stdio(false);
    // cin.tie(nullptr);
    // cout.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        vision();
    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 54ms
memory: 31960kb

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: 171
Case 2: 793
Case 3: 926
Case 4: 185
Case 5: 446
Case 6: 380
Case 7: 171
Case 8: 458
Case 9: 344
Case 10: 197
Case 11: 254
Case 12: 221
Case 13: 938
Case 14: 543
Case 15: 168
Case 16: 181
Case 17: 269
Case 18: 450
Case 19: 390
Case 20: 241
Case 21: 218
Case 22: 440
Case 23: 674
Case 24: 3...

result:

wrong answer 1st lines differ - expected: 'Case 1: 249', found: 'Case 1: 171'