QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#647973#1774. Customs ControlsjzwzyWA 0ms3868kbC++14882b2024-10-17 16:25:552024-10-17 16:25:56

Judging History

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

  • [2024-10-17 16:25:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3868kb
  • [2024-10-17 16:25:55]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 100010;

int n, m, k;
int t[N];
int h[N], to[N * 2], nxt[N * 2], tot;
char ans[N];

void add(int a, int b) {
	to[++tot] = b, nxt[tot] = h[a], h[a] = tot;
}

int main() {
	scanf("%d%d%d", &n, &m, &k);
	if (n == 2 && k == 1) {
		puts("impossible");
		return 0;
	}
	for (int i = 1; i <= n; i++)
		scanf("%d", &t[i]);
	for (int i = 1; i <= m; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		if (a == b)
			continue;
		add(a, b);
		add(b, a);
	}
	ans[1] = 'S';
	k--;
	if (k)
		for (int i = h[1]; i; i = nxt[i]) {
			int v = to[i];
			ans[v] = 'S';
			if (--k == 0) break;
		}
	if (k)
		for (int i = 1; i <= n; i++)
			if (!ans[i]) {
				ans[i] = 'S';
				if (--k == 0)
					break;
			}
	for (int i = 1; i <= n; i++)
		if (!ans[i])
			ans[i] = 'N';
	puts(ans + 1);
	return 0;
}

详细

Test #1:

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

input:

5 10 2
1 1 1 1 1
3 4
5 4
3 1
4 1
3 5
2 1
2 4
2 5
1 5
2 3

output:

SNNNS

result:

wrong answer number of N:s not equal to k