제출 #743261

#제출 시각아이디문제언어결과실행 시간메모리
743261salmonViruses (BOI20_viruses)C++14
11 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; int G,N,M; vector<pair<int,vector<int>>> lst; int cont[110]; //vector<vector<int>> bask[110]; vector<int> listener[110]; unsigned long long int d[110]; priority_queue<pair<unsigned long long int, int>,vector<pair<unsigned long long int, int>>,greater<pair<unsigned long long int, int>>> pq; int n,h,in; int main(){ scanf(" %d",&G); scanf(" %d",&N); scanf(" %d",&M); for(int i = 0; i < 105; i++){ cont[i] = 0; d[i] = 0; } for(int i = 0; i < N; i++){ scanf(" %d",&in); vector<int> v; scanf(" %d",&n); for(int i = 0; i < G; i++){ v.push_back(0); } for(int j = 0; j < n; j++){ scanf(" %d",&h); if(v[h] == 0){ listener[h].push_back(i); cont[i]++; } v[h]++; } lst.push_back(make_pair(in,v)); } pq.push(make_pair(1,0)); pq.push(make_pair(1,1)); while(!pq.empty()){ int i = pq.top().second; if(d[i] != 0){ pq.pop(); continue; } d[i] = pq.top().first; pq.pop(); while(!listener[i].empty()){ cont[listener[i][listener[i].size() - 1]]--; if(cont[listener[i][listener[i].size() - 1]] == 0){ int j = listener[i][listener[i].size() - 1]; unsigned long long int V = 0; for(int i = 0; i < G; i++){ V = V + d[i] * lst[j].second[i]; } pq.push(make_pair(V,lst[j].first)); } listener[i].pop_back(); } } for(int i = 2; i < G; i++){ if(d[i] == 0){ printf("YES\n"); } else{ printf("NO %llu\n",d[i]); } } }

컴파일 시 표준 에러 (stderr) 메시지

Viruses.cpp: In function 'int main()':
Viruses.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf(" %d",&G);
      |     ~~~~~^~~~~~~~~~
Viruses.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf(" %d",&N);
      |     ~~~~~^~~~~~~~~~
Viruses.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf(" %d",&M);
      |     ~~~~~^~~~~~~~~~
Viruses.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |   scanf(" %d",&in);
      |   ~~~~~^~~~~~~~~~~
Viruses.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         scanf(" %d",&n);
      |         ~~~~~^~~~~~~~~~
Viruses.cpp:33:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |             scanf(" %d",&h);
      |             ~~~~~^~~~~~~~~~
#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...