QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#600979#6561. Fail FastForever_YoungWA 1ms6344kbC++14526b2024-09-29 20:20:332024-09-29 20:20:36

Judging History

你现在查看的是最新测评结果

  • [2024-09-29 20:20:36]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6344kb
  • [2024-09-29 20:20:33]
  • 提交

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});
    }
}

Details

Tip: Click on the bar to expand more detailed information

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