Submission #47923

#TimeUsernameProblemLanguageResultExecution timeMemory
47923TalantBitaro’s Party (JOI18_bitaro)C++17
7 / 100
2095 ms12540 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 <= v; 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 (int to : g[v]) { if (d[v] + 1 > d[to]) { d[to] = d[v] + 1; q.push({d[to],to}); } } } } main () { scanf("%d%d%d", &n,&m,&qy); for (int i = 1; i <= m; i ++) { scanf("%d%d", &l,&r); g[r].pb(l); } scan(t);scan(y); if (y == n) { cout << "-1"; return 0; } for (int i = 1; i <= y; i ++) { scanf("%d", &x); u[x] = 1; } djk(t); printf("%d\n", ans); return 0; }

Compilation message (stderr)

bitaro.cpp:54:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
bitaro.cpp: In function 'int main()':
bitaro.cpp:55:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       scanf("%d%d%d", &n,&m,&qy);
       ~~~~~^~~~~~~~~~~~~~~~~~~~~
bitaro.cpp:58:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d%d", &l,&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:62: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:62:15: note: in expansion of macro 'scan'
       scan(t);scan(y);
               ^~~~
bitaro.cpp:70:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &x);
             ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...