Submission #286200

#TimeUsernameProblemLanguageResultExecution timeMemory
286200spdskatrViruses (BOI20_viruses)C++14
11 / 100
1 ms256 KiB
#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 (stderr)

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);
      |    ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...