제출 #743167

#제출 시각아이디문제언어결과실행 시간메모리
743167Azther0zBitaro’s Party (JOI18_bitaro)C++11
7 / 100
2080 ms9968 KiB
#include <bits/stdc++.h> using namespace std; vector<vector<int>> adjl(100001); bitset<100001> visited,busy; int result; void dijkstra(int start) { priority_queue<pair<int,int>> pq; vector<int> dist(100001,0); pq.push({0,start}); while(!pq.empty()) { int d=pq.top().first,current=pq.top().second; pq.pop(); if(d!=dist[current]) continue; if(!busy[current]) result=max(result,d); for(auto next:adjl[current]) if(d+1>dist[next]) { dist[next]=d+1; pq.push({dist[next],next}); } } } int main() { int n,m,q; scanf("%d%d%d",&n,&m,&q); while(m--) { int a,b; scanf("%d%d",&a,&b); adjl[b].push_back(a); } while(q--) { int a,b,c; scanf("%d%d",&a,&b); visited=busy=0; while(b--) { scanf("%d",&c); busy[c]=true; } result=-1; dijkstra(a); printf("%d\n",result); } }

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

bitaro.cpp: In function 'int main()':
bitaro.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |  scanf("%d%d%d",&n,&m,&q);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
bitaro.cpp:34:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |   scanf("%d%d",&a,&b);
      |   ~~~~~^~~~~~~~~~~~~~
bitaro.cpp:40:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |   scanf("%d%d",&a,&b);
      |   ~~~~~^~~~~~~~~~~~~~
bitaro.cpp:44:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |    scanf("%d",&c);
      |    ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...