QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#420175#8593. CoinMuhammad-Saram#0 1ms3580kbC++17747b2024-05-24 15:05:142024-05-24 15:05:15

Judging History

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

  • [2024-05-24 15:05:15]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3580kb
  • [2024-05-24 15:05:14]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

signed main()
{
	int n,m;
	cin>>n>>m;
	int ans[n];
	for (int i=0;i<n;i++)
		ans[i]=-1;
	set<int> le[n],gr[n];
	for (int we=1;we<=m;we++)
	{
		int u,v;
		cin>>u>>v;
		u--,v--;
		le[v].insert(u);
		gr[u].insert(v);
		for (int i:le[u])
			for (int j:gr[v])
			{
				le[j].insert(i);
				gr[i].insert(j);
			}
		for (int i:le[u])
			le[v].insert(i);
		for (int i:gr[v])
			gr[u].insert(i);
		for (int i=0;i<n;i++)
		{
			if (ans[i]==-1 and gr[i].size()+le[i].size()==n-1)
				ans[i]=we;
		}
	}
	for (int i=0;i<n;i++)
		cout<<ans[i]<<' ';
	cout<<endl;
	
	return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 6
Accepted
time: 1ms
memory: 3580kb

input:

4 4
2 4
3 1
4 1
2 3

output:

3 4 -1 -1 

result:

ok ac

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3512kb

input:

6 8
1 5
5 4
6 2
2 5
4 3
6 1
6 5
2 1

output:

-1 -1 -1 -1 -1 -1 

result:

wrong answer wa

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%