Submission #1008193

# Submission time Handle Problem Language Result Execution time Memory
1008193 2024-06-26T08:19:19 Z imarn Cyberland (APIO23_cyberland) C++17
49 / 100
1268 ms 48240 KB
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define plx pair<ll,int>
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
#define vi vector<int>
using namespace std;
const int mxn=1e5+5;
vector<pair<int,double>>g[mxn];
double d[67][mxn]{0};
bool use[67][mxn]{0};
bool vis[mxn]{0};
void dfs(int u,int n){
    vis[u]=1;
    for(auto v:g[u]){
        if(v.f==n||vis[v.f])continue;
        dfs(v.f,n);
    }
}
priority_queue<pair<double,pii>,vector<pair<double,pii>>,greater<pair<double,pii>>>q;
double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr){
    K=min(K,66);for(int i=0;i<M;i++)g[x[i]].pb({y[i],c[i]}),g[y[i]].pb({x[i],c[i]});dfs(0,H);
    for(int i=0;i<=K;i++)for(int j=0;j<N;j++)d[i][j]=1e17;
    memset(use,0,sizeof use);
    d[0][0]=0;q.push({0,{0,0}});arr[0]=0;double ans=1e17;
    for(int i=1;i<N;i++)if(arr[i]==0&&vis[i])d[0][i]=0,q.push({0,{0,i}});
    while(!q.empty()){
        auto u=q.top();q.pop();
        if(use[u.s.f][u.s.s])continue;use[u.s.f][u.s.s]=1;
        if(u.s.s==H){ans=min(ans,u.f);continue;}
        for(auto v:g[u.s.s]){
            if(!arr[v.f])continue;
            if(d[u.s.f][v.f]>u.f+v.s)d[u.s.f][v.f]=u.f+v.s,q.push({u.f+v.s,{u.s.f,v.f}});
            if(arr[v.f]==2&&u.s.f<K){
                double t = (u.f+v.s)/2;
                if(d[u.s.f+1][v.f]>t)d[u.s.f+1][v.f]=t,q.push({t,{u.s.f+1,v.f}});
            }
        }
    }for(int i=0;i<N;i++)g[i].clear();memset(vis,0,sizeof vis);
    return (ans>=1e17?-1:ans);
}

Compilation message

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:33:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   33 |         if(use[u.s.f][u.s.s])continue;use[u.s.f][u.s.s]=1;
      |         ^~
cyberland.cpp:33:39: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   33 |         if(use[u.s.f][u.s.s])continue;use[u.s.f][u.s.s]=1;
      |                                       ^~~
# Verdict Execution time Memory Grader output
1 Correct 1255 ms 35164 KB Correct.
2 Correct 1268 ms 35408 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 31 ms 35160 KB Correct.
2 Correct 36 ms 36176 KB Correct.
3 Correct 33 ms 35932 KB Correct.
4 Correct 34 ms 35928 KB Correct.
5 Correct 38 ms 36176 KB Correct.
6 Correct 24 ms 36648 KB Correct.
7 Correct 27 ms 36944 KB Correct.
8 Correct 14 ms 37208 KB Correct.
9 Correct 138 ms 35924 KB Correct.
10 Correct 134 ms 35660 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 35 ms 35364 KB Correct.
2 Correct 36 ms 36016 KB Correct.
3 Correct 34 ms 36016 KB Correct.
4 Correct 138 ms 35684 KB Correct.
5 Correct 154 ms 35924 KB Correct.
6 Correct 8 ms 36184 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 63 ms 41156 KB Correct.
2 Incorrect 85 ms 36176 KB Wrong Answer.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 35420 KB Correct.
2 Correct 33 ms 36160 KB Correct.
3 Correct 33 ms 36064 KB Correct.
4 Correct 27 ms 37204 KB Correct.
5 Correct 139 ms 35748 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 34 ms 35416 KB Correct.
2 Correct 32 ms 36064 KB Correct.
3 Correct 37 ms 42952 KB Correct.
4 Correct 17 ms 36952 KB Correct.
5 Correct 146 ms 35668 KB Correct.
6 Correct 31 ms 36184 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 96 ms 35420 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 187 ms 48240 KB Wrong Answer.
2 Halted 0 ms 0 KB -