QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#600979 | #6561. Fail Fast | Forever_Young | WA | 1ms | 6344kb | C++14 | 526b | 2024-09-29 20:20:33 | 2024-09-29 20:20:36 |
Judging History
answer
#include<bits/stdc++.h>
#define N 100005
using namespace std;
vector<int> v[N];
double c[N],d[N];
int n;
int main(){
scanf("%d",&n);
for (int i=1;i<=n;i++){
int fa;
scanf("%lf%lf%d",&c[i],&d[i],&fa);
v[fa].push_back(i);
}
priority_queue<pair<double,int>> q;
for (int x:v[0]) q.push({-c[x]/(1-d[x]),x});
while(!q.empty()){
int x = q.top().second;
q.pop();
printf("%d\n",x);
for (int y:v[x]) q.push({-c[y]/(1-d[y]),y});
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 6344kb
input:
4 100 0.5 0 200 0.1 1 10 0.5 2 10 0.9 0
output:
4 1 2 3
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 6104kb
input:
4 84 0.716 0 91 0.115 0 19 0.640 1 103 0.455 0
output:
2 4 1 3
result:
wrong answer your plan is not optimal