QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#420070#8593. CoinFaisal-Saqib#Compile Error//C++171.4kb2024-05-24 14:27:472024-05-24 14:27:48

Judging History

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

  • [2024-05-24 14:27:48]
  • 评测
  • [2024-05-24 14:27:47]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=200000+1;
vector<int> ma[N];
vector<int> ma_[N];
int deg[N];
bitset<N> L[N];
bitset<N> G[N];
signed main()
{
	int n,m;
	cin>>n>>m;
	for(int j=0;j<m;j++)
	{
		int x,y;
		cin>>x>>y;
		ma[x].push_back(y);
		ma_[y].push_back(x);
		deg[y]++;
	}
	queue<int> q;
	for(int j=1;j<=n;j++)
	{
		if(deg[j]==0)
		{
			q.push(j);
		}
	}
	vector<int> level;
	while(q.size())
	{
		int f=q.front();
		level.push_back(f);
		q.pop();
		for(auto nx:ma[f])
		{
			L[nx]|=L[f];
			L[nx].set(f);
			deg[nx]--;
			if(deg[nx]==0)
			{
				q.push(nx);
			}
		}
	}
	while(level.size())
	{
		int f=level.back();
		level.pop_back();
		for(auto nx:ma_[f])
		{
			G[nx]|=G[f];
			G[nx].set(f);
		}
	}
	// for(int j=1;j<=n;j++)
	// {
	// 	cout<<"Less than "<<j<<" are: ";
	// 	for(int k=1;k<=n;k++)
	// 	{
	// 		if(L[j][k])
	// 		{
	// 			cout<<k<<' ';
	// 		}
	// 	}
	// 	cout<<endl;
	// }
	// for(int j=1;j<=n;j++)
	// {
	// 	cout<<"Greater than "<<j<<" are: ";
	// 	for(int k=1;k<=n;k++)
	// 	{
	// 		if(G[j][k])
	// 		{
	// 			cout<<k<<' ';
	// 		}
	// 	}
	// 	cout<<endl;
	// }
	for(int v=1;v<=n;v++)
	{
		bitset<N> cur=(G[v]|L[v]);
		if(cur.count()==(n-1))
		{
			cout<<1<<' ';
		}
		else{
			cout<<-1<<' ';
		}
	}
	cout<<'\n;
	return 0;
}

詳細信息

answer.code:92:15: warning: missing terminating ' character
   92 |         cout<<'\n;
      |               ^
answer.code:92:15: error: missing terminating ' character
   92 |         cout<<'\n;
      |               ^~~~
answer.code: In function ‘int main()’:
answer.code:93:9: error: expected primary-expression before ‘return’
   93 |         return 0;
      |         ^~~~~~