답안 #286192

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

using namespace std;

int G, N, M, 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] = 696969;
	for (int t = 0; t < G; t++) {
		for (int g = 2; g < G; g++) {
			for (int i : rec[g]) {
				int val = 0;
				for (int v : mut[i]) {
					val += dp[v];
				}
				dp[g] = min(dp[g], val);
			}
		}
	}
	for (int i = 2; i < G; i++) {
		if (dp[i] >= 696969) {
			printf("YES\n");
		} else {
			printf("NO %d\n", dp[i]);
		}
	}
}

Compilation message

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