Submission #749596

# Submission time Handle Problem Language Result Execution time Memory
749596 2023-05-28T09:44:55 Z Cookie Cyberland (APIO23_cyberland) C++17
15 / 100
980 ms 92716 KB
#include<bits/stdc++.h>
#include "cyberland.h"
#include<fstream>
using namespace std;
ifstream fin("VNOICUP.INP");
ofstream fout("VNOICUP.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
const int mxn = 1e5;
struct ch{
    int u, take; ld dd;
};
struct cmp{
    bool operator()(const ch &a, const ch &b){
        return(a.dd > b.dd);
    }
};
vt<pii>adj[mxn + 1];
ld d[mxn + 1][71];
bool vis[mxn + 1], go[mxn + 1][71];
void dfs(int s){
    vis[s] = 1;
    for(auto [v, w]: adj[s]){
        if(!vis[v])dfs(v);
    }
}
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, 70);
    forr(i, 0, n){
        adj[i].clear();
        forr(j, 0, k + 1){
            d[i][j] = 1e18; go[i][j] = 0;
        }
        vis[i] = 0;
    }
    forr(i, 0, m){
        int u = x[i], v = y[i], w = c[i];
        adj[u].pb({v, w}); adj[v].pb({u, w});
    }
    dfs(0);
    if(!vis[h])return(-1);
    priority_queue<ch, vt<ch>, cmp>pq; 
    for(int i = 0; i < n; i++){
        if((i == 0 || !arr[i]) && vis[i]){
            d[i][0] = 0; pq.push({i, 0, d[i][0]});
        }
    }
    while(!pq.empty()){
        auto [u, take, dd] = pq.top(); pq.pop();
        if(go[u][take])continue; go[u][take] = 1;
        if(u == h)continue;
        for(auto [v, w]: adj[u]){
            if(d[v][take] > d[u][take] + w){
                d[v][take] = d[u][take] + w;
                pq.push({v, take, d[v][take]});
            }if(arr[v] == 2 && take < k){
                if(d[v][take + 1] > (d[u][take] + w) / 2.0){
                    d[v][take + 1] = (d[u][take] + w) / 2.0;
                    pq.push({v, take + 1, d[v][take + 1]});
                }
            }
        }
    }
    ld ans = 1e18;
    for(int i = 0; i <= k; i++)ans = min(ans, d[h][i]);
    return(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:60:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   60 |         if(go[u][take])continue; go[u][take] = 1;
      |         ^~
cyberland.cpp:60:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   60 |         if(go[u][take])continue; go[u][take] = 1;
      |                                  ^~
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 2772 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 4036 KB Correct.
2 Correct 37 ms 3936 KB Correct.
3 Correct 36 ms 3976 KB Correct.
4 Correct 35 ms 3924 KB Correct.
5 Correct 35 ms 3904 KB Correct.
6 Correct 40 ms 15096 KB Correct.
7 Correct 47 ms 14796 KB Correct.
8 Correct 28 ms 27220 KB Correct.
9 Correct 32 ms 2772 KB Correct.
10 Correct 32 ms 2868 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 3964 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 980 ms 92716 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 29 ms 4052 KB Correct.
2 Correct 33 ms 4040 KB Correct.
3 Correct 34 ms 4128 KB Correct.
4 Correct 38 ms 15036 KB Correct.
5 Correct 28 ms 2868 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 4044 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 195 ms 4824 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 426 ms 5832 KB Wrong Answer.
2 Halted 0 ms 0 KB -