QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#676438 | #6527. Cyberland | neilliu | 0 | 243ms | 44772kb | C++17 | 2.0kb | 2024-10-25 21:32:18 | 2024-10-25 21:32:18 |
Judging History
answer
#include "cyberland.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
#define MAXN 100005
vector<int> edge[MAXN];
vector<int> lian[MAXN];
bool ok[MAXN];
double dis[70][100005];
bool vis[70][MAXN];
struct kkk{
int id;
int ceng;
double w;
friend bool operator <(kkk ano1,kkk ano2){
if(ano1.ceng == ano2.ceng)
return ano1.w > ano2.w;
else return ano1.ceng > ano2.ceng;
}
};
priority_queue<kkk> qq;
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) {
for(int i = 0; i < N; i++) edge[i].clear(),lian[i].clear();
for(int i = 0; i < N; i++) ok[i] = 0;
for(int i = 0; i < M; i++){
edge[x[i]].push_back(y[i]);
edge[y[i]].push_back(x[i]);
lian[x[i]].push_back(c[i]);
lian[y[i]].push_back(c[i]);
}
queue<int> q; q.push(0);
while(q.size()){
int nowx = q.front(); q.pop();
if(ok[nowx]) continue;
ok[nowx] = 1;
for(int v : edge[nowx]){
q.push(v);
}
}
if(!ok[H]) return -1;
for(int i = 0; i <= K; i++){
for(int j = 0; j <= N; j++) dis[i][j] = 1e17,vis[i][j] = 0;
}
while(qq.size()) qq.pop();
for(int i = 0; i < N; i++){
if(arr[i] == 0 && ok[i] == 1){
qq.push((kkk){i,0,0});
dis[0][i] = 0;
}
}
qq.push((kkk){0,0,0});
dis[0][0] = 0;
double ans = 1e17;
int cengok[100];
memset(cengok,0,sizeof(cengok));
while(qq.size()){
int nowx = qq.top().id,ceng = qq.top().ceng; qq.pop();
if(cengok[ceng]) continue;
if(vis[ceng][nowx]) continue;
vis[ceng][nowx] = 1;
if(nowx % N == H) {
ans = min(ans,dis[ceng][nowx]);
cengok[ceng] = 1;
continue;
}
if(dis[ceng+1][nowx] > dis[ceng][nowx] / 2.0){
dis[ceng+1][nowx] = dis[ceng][nowx] / 2.0;
qq.push((kkk){nowx,ceng+1,dis[ceng+1][nowx]});
}
for(int vv = 0; vv < edge[nowx].size(); vv++){
int v = edge[nowx][vv];
if(dis[ceng][v] > dis[ceng][nowx] + lian[nowx][vv]){
dis[ceng][v] = dis[ceng][nowx] + lian[nowx][vv];
qq.push((kkk){v,ceng,dis[ceng][v]});
}
}
}
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 21ms
memory: 38312kb
input:
10000 2 1 30 1 1 1 1 0 13080 3 3 30 1 1 1 1 0 2 25242 2 1 13399 1 0 2123 2 1 30 1 1 1 0 1 11947 2 1 30 1 1 1 0 1 27361 3 0 30 2 1 0 1 2 0 30 1 1 1 3 2 30 1 1 1 2 1 2 23211 0 1 9991 3 1 30 1 1 1 1 2 1 3093 2 1 30 1 1 1 1 0 10703 2 1 30 1 1 1 0 1 15754 2 1 30 1 1 1 1 0 18752 2 1 30 1 1 1 1 0 2300 2 1 ...
output:
a9100fda0a7059a979d560b8550f715d4ee391ff9b8b680b2f87b26a69ee5a5e 13080.000000000000000 2123.000000000000000 11947.000000000000000 27361.000000000000000 -1.000000000000000 -1.000000000000000 9991.000000000000000 -1.000000000000000 10703.000000000000000 15754.000000000000000 18752.000000000000000 2300...
result:
wrong answer Wrong Answer.
Subtask #2:
score: 0
Wrong Answer
Test #3:
score: 0
Wrong Answer
time: 65ms
memory: 38688kb
input:
100 982 981 30 107 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
a9100fda0a7059a979d560b8550f715d4ee391ff9b8b680b2f87b26a69ee5a5e 492750367.233088493347168 429539738.159182548522949 230960091.283840984106064 948623800.677801489830017 303842413.968125522136688 533318618.456552684307098 251031536.817513883113861 705010934.607807755470276 385609126.723299860954285 4...
result:
wrong answer Wrong Answer.
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Wrong Answer
Test #19:
score: 0
Wrong Answer
time: 243ms
memory: 44772kb
input:
1 58243 58242 30 14059 1 2 0 1 0 2 2 0 0 0 1 0 2 0 2 1 2 1 0 0 0 2 1 0 0 0 0 1 2 1 0 2 0 2 2 2 2 2 0 0 2 2 1 2 1 2 0 2 2 1 2 0 0 1 0 0 0 0 2 2 0 0 2 2 1 0 0 0 2 2 0 1 2 1 0 2 0 0 2 0 1 0 2 1 2 2 1 1 2 1 2 1 2 2 0 1 0 1 1 2 1 2 2 1 0 1 2 1 2 1 0 2 2 2 1 2 0 1 0 1 0 1 2 0 0 0 2 2 1 1 1 2 0 1 2 2 2 2 1...
output:
a9100fda0a7059a979d560b8550f715d4ee391ff9b8b680b2f87b26a69ee5a5e 635342831.000000000000000 a9100fda0a7059a979d560b8550f715d4ee391ff9b8b680b2f87b26a69ee5a5e
result:
wrong answer Wrong Answer.
Subtask #5:
score: 0
Wrong Answer
Test #24:
score: 0
Wrong Answer
time: 40ms
memory: 37556kb
input:
100 442 637 30 269 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
a9100fda0a7059a979d560b8550f715d4ee391ff9b8b680b2f87b26a69ee5a5e 389363755.046903133392334 -1.000000000000000 253131647.331355631351471 -1.000000000000000 591352793.529291868209839 210853338.488927036523819 -1.000000000000000 46497126.473103545606136 2075988.167979358695447 538511101.605446219444275...
result:
wrong answer Wrong Answer.
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #6:
0%
Subtask #8:
score: 0
Skipped
Dependency #1:
0%