QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#716567#9532. 长野原龙势流星群konata2828Compile Error//C++201.1kb2024-11-06 15:33:502024-11-06 15:33:50

Judging History

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

  • [2024-11-06 15:33:50]
  • 评测
  • [2024-11-06 15:33:50]
  • 提交

answer

// Hydro submission #672b1bdca0596789666367e2@1730878429179
#include<bits/stdc++.h>
#define int long long
using namespace std;
int sum[1000005];
int num[1000005];
int n;
struct node
{
	int pos;
	int ansx,ansy;
	bool operator < (const node a) const
	{
		return ansx*a.ansy<ansy*a.ansx;
	}
};
vector<int> e[1000005];
priority_queue<node> q;
signed main()
{
//	freopen("array.in","r",stdin);
//	freopen("array.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=2;i<=n;i++)
	{a
		int x;
		cin>>x;
		e[i].push_back(x);
	}
	for(int i=1;i<=n;i++)
		cin>>sum[i],num[i]=1,q.push({i,sum[i],num[i]});
	while(!q.empty())
	{
		node x=q.top();
		q.pop();
		if(sum[x.pos]!=x.ansx||num[x.pos]!=x.ansy)
			continue;
		for(int y:e[x.pos])
		{
			int nansx=sum[x.pos]+sum[y];
			int nansy=num[x.pos]+num[y];
			if(nansx*num[y]>sum[y]*nansy)
			{
				sum[y]=nansx;
				num[y]=nansy;
				q.push({y,sum[y],num[y]});
			}
		}
	}
	for(int i=1;i<=n;i++)
		cout<<fixed<<setprecision(10)<<sum[i]*1.0/num[i]<<"\n";
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:28:10: error: ‘a’ was not declared in this scope
   28 |         {a
      |          ^
answer.code:30:22: error: ‘x’ was not declared in this scope
   30 |                 cin>>x;
      |                      ^