답안 #286200

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
286200 2020-08-30T08:20:16 Z spdskatr Viruses (BOI20_viruses) C++14
11 / 100
1 ms 256 KB
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>

using namespace std;

int G, N, M;
long long dp[105];
vector<int> rec[105];
vector<int> mut[105];
vector<int> nice[105];

int main() {
	scanf("%d %d %d", &G, &N, &M);
	for (int i = 0; i < N; i++) {
		int a, k;
		scanf("%d %d", &a, &k);
		rec[a].push_back(i);
		for (int j = 0; j < k; j++) {
			int v;
			scanf("%d", &v);
			mut[i].push_back(v);
		}
	}
	dp[0] = dp[1] = 1;
	for (int i = 2; i < G; i++) dp[i] = -1;
	for (int t = 0; t < G; t++) {
		for (int g = 2; g < G; g++) {
			for (int i : rec[g]) {
				int rip = 0;
				long long val = 0;
				for (int v : mut[i]) {
					if (dp[v] == -1) rip = 1;
					val += dp[v];
				}
				if (rip) continue;
				if (dp[g] == -1) dp[g] = val;
				else dp[g] = min(dp[g], val);
			}
		}
	}
	for (int i = 2; i < G; i++) {
		if (dp[i] == -1) {
			printf("YES\n");
		} else {
			printf("NO %lld\n", dp[i]);
		}
	}
}

Compilation message

Viruses.cpp: In function 'int main()':
Viruses.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |  scanf("%d %d %d", &G, &N, &M);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Viruses.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |   scanf("%d %d", &a, &k);
      |   ~~~~~^~~~~~~~~~~~~~~~~
Viruses.cpp:22:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |    scanf("%d", &v);
      |    ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 0 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Incorrect 0 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Incorrect 0 ms 256 KB Output isn't correct
22 Halted 0 ms 0 KB -