QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#647973 | #1774. Customs Controls | jzwzy | WA | 0ms | 3868kb | C++14 | 882b | 2024-10-17 16:25:55 | 2024-10-17 16:25:56 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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