# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1009184 |
2024-06-27T09:47:59 Z |
pcc |
Cyberland (APIO23_cyberland) |
C++17 |
|
262 ms |
12496 KB |
#include "cyberland.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#define ld double
#define pii pair<int,int>
#define fs first
#define sc second
const ld inf = 1e15;
const int mxn = 1e5+10;
const int lim = 60;
ld dist[mxn];
vector<pii> paths[mxn];
bitset<mxn> able;
int N,M;
namespace DIJKSTRA{
bitset<mxn> done;
priority_queue<pair<ld,int>,vector<pair<ld,int>>,greater<pair<ld,int>>> pq;
void GO(int ban){
for(int i = 0;i<N;i++){
done[i] = 0;
if(ban != i&&able[i])pq.push(make_pair(dist[i],i));
}
while(!pq.empty()){
auto now = pq.top().sc;
pq.pop();
if(done[now])continue;
done[now] = true;
for(auto &[nxt,w]:paths[now]){
if(!able[nxt]||done[nxt])continue;
if(dist[nxt]>dist[now]+w){
dist[nxt] = dist[now]+w;
if(nxt != ban)pq.push(make_pair(dist[nxt],nxt));
}
}
}
return;
}
}
void init(){
for(int i = 0;i<N;i++)paths[i].clear();
}
double solve(int NN, int MM, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> z, std::vector<int> arr) {
init();
N = NN,M = MM;
for(int i = 0;i<M;i++){
int a = x[i],b = y[i],c = z[i];
paths[a].push_back(pii(b,c));
paths[b].push_back(pii(a,c));
}
for(int i = 0;i<N;i++)able[i] = true,dist[i] = inf;
dist[0] = 0;
DIJKSTRA::GO(H);
for(int i = 0;i<N;i++){
if(dist[i]+1<inf)able[i] = true;
else able[i] = false;
}
if(!able[H])return -1;
for(int i = 0;i<N;i++){
if(able[i]&&arr[i] == 0)dist[i] = 0;
else dist[i] = inf;
}
dist[0] = 0;
ld ans = inf;
for(int i = 0;i<=min(lim,K);i++){
DIJKSTRA::GO(-1);
ans = min(ans,dist[H]);
dist[H] = inf;
for(int j = 0;j<N;j++){
if(!able[j])dist[j] = inf;
else if(arr[j] == 2)dist[j] /= 2;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
2904 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
75 ms |
2968 KB |
Correct. |
2 |
Correct |
90 ms |
2908 KB |
Correct. |
3 |
Correct |
86 ms |
2940 KB |
Correct. |
4 |
Correct |
101 ms |
2904 KB |
Correct. |
5 |
Correct |
90 ms |
2936 KB |
Correct. |
6 |
Correct |
174 ms |
3792 KB |
Correct. |
7 |
Correct |
262 ms |
3664 KB |
Correct. |
8 |
Correct |
111 ms |
4828 KB |
Correct. |
9 |
Correct |
66 ms |
2648 KB |
Correct. |
10 |
Correct |
65 ms |
2652 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
102 ms |
2920 KB |
Correct. |
2 |
Correct |
93 ms |
3692 KB |
Correct. |
3 |
Correct |
76 ms |
3664 KB |
Correct. |
4 |
Correct |
76 ms |
3600 KB |
Correct. |
5 |
Correct |
70 ms |
3596 KB |
Correct. |
6 |
Correct |
36 ms |
3932 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
97 ms |
7900 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
2908 KB |
Correct. |
2 |
Correct |
46 ms |
2988 KB |
Correct. |
3 |
Correct |
46 ms |
2908 KB |
Correct. |
4 |
Correct |
87 ms |
3680 KB |
Correct. |
5 |
Correct |
31 ms |
2648 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
2908 KB |
Correct. |
2 |
Correct |
38 ms |
3676 KB |
Correct. |
3 |
Correct |
46 ms |
12496 KB |
Correct. |
4 |
Correct |
56 ms |
4184 KB |
Correct. |
5 |
Correct |
39 ms |
3676 KB |
Correct. |
6 |
Correct |
44 ms |
3932 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
59 ms |
2908 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
88 ms |
2904 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |