제출 #47788

#제출 시각아이디문제언어결과실행 시간메모리
47788TalantBitaro’s Party (JOI18_bitaro)C++14
7 / 100
1640 ms12632 KiB
#include <bits/stdc++.h> #define mk make_pair #define sc second #define fr first #define pb emplace_back #define all(s) s.begin(), s.end() #define sz(s) ( (int)s.size() ) #define Scan(a) scanf ("%I64d", &a) #define scan(a) scanf ("%d", &a) using namespace std; const int inf = (int)1e9 + 7; const int N = (int)3e5 + 7; vector <int> g[N]; priority_queue<pair<int,int> > q; int d[N],u[N]; int n,m,qy; int l,r; int t,y,x; int ans = -1; int cnt; void djk(int v) { for (int i = 1; i <= n; i ++) d[i] = -inf; d[v] = 0; q.push({0,v}); while (!q.empty()) { int v = q.top().sc,cur = q.top().fr; q.pop(); if (!u[v]) ans = max(ans,d[v]); if (cur < d[v]) continue; for (auto to : g[v]) { if (d[v] + 1 > d[to]) { d[to] = d[v] + 1; q.push({d[to],to}); } cnt ++; } cnt ++; if (cnt > (int)4e7) { cout << ans << endl; exit(0); } } } main () { scan(n);scan(m);scan(qy); for (int i = 1; i <= m; i ++) { scan(l);scan(r); g[r].pb(l); } scan(t);scan(y); if (y == n) { cout << "-1"; return 0; } for (int i = 1; i <= y; i ++) { scan(x); u[x] = 1; } djk(t); printf("%d\n", ans); return 0; }

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

bitaro.cpp:60:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
bitaro.cpp: In function 'int main()':
bitaro.cpp:10:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 #define scan(a) scanf ("%d", &a)
                 ~~~~~~^~~~~~~~~~
bitaro.cpp:61:7: note: in expansion of macro 'scan'
       scan(n);scan(m);scan(qy);
       ^~~~
bitaro.cpp:10:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 #define scan(a) scanf ("%d", &a)
                 ~~~~~~^~~~~~~~~~
bitaro.cpp:61:15: note: in expansion of macro 'scan'
       scan(n);scan(m);scan(qy);
               ^~~~
bitaro.cpp:10:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 #define scan(a) scanf ("%d", &a)
                 ~~~~~~^~~~~~~~~~
bitaro.cpp:61:23: note: in expansion of macro 'scan'
       scan(n);scan(m);scan(qy);
                       ^~~~
bitaro.cpp:10:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 #define scan(a) scanf ("%d", &a)
                 ~~~~~~^~~~~~~~~~
bitaro.cpp:64:13: note: in expansion of macro 'scan'
             scan(l);scan(r);
             ^~~~
bitaro.cpp:10:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 #define scan(a) scanf ("%d", &a)
                 ~~~~~~^~~~~~~~~~
bitaro.cpp:64:21: note: in expansion of macro 'scan'
             scan(l);scan(r);
                     ^~~~
bitaro.cpp:10:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 #define scan(a) scanf ("%d", &a)
                 ~~~~~~^~~~~~~~~~
bitaro.cpp:68:7: note: in expansion of macro 'scan'
       scan(t);scan(y);
       ^~~~
bitaro.cpp:10:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 #define scan(a) scanf ("%d", &a)
                 ~~~~~~^~~~~~~~~~
bitaro.cpp:68:15: note: in expansion of macro 'scan'
       scan(t);scan(y);
               ^~~~
bitaro.cpp:10:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 #define scan(a) scanf ("%d", &a)
                 ~~~~~~^~~~~~~~~~
bitaro.cpp:76:13: note: in expansion of macro 'scan'
             scan(x);
             ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...