제출 #95059

#제출 시각아이디문제언어결과실행 시간메모리
95059omidazadiBitaro’s Party (JOI18_bitaro)C++14
0 / 100
17 ms10488 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pll pair <ll , ll> #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define mp make_pair #define X first #define Y second #define LB(x) ((x) & -(x)) #define BIT(x , y) (((x) >> (y)) & 1) const ll MAXN=1e5+10; const ll SQ=1e2+10; vector <pll> e[MAXN]; vector <ll> in[MAXN]; vector <ll> out[MAXN]; ll z[MAXN]; ll dp[MAXN]; int main() { ios_base :: sync_with_stdio(false); cin.tie(0); ll n , m , q; cin>>n>>m>>q; for(ll i=1;i<=m;i++) { ll v , u; cin>>v>>u; out[v].pb(u); in[u].pb(v); } for(ll i=1;i<=n;i++) { for(ll j=0;j<in[i].size();j++) { ll v=in[i][j]; for(ll u=0;u<e[v].size();u++) { e[i].pb(mp(e[v][u].X+1 , e[v][u].Y)); } } sort(e[i].begin() , e[i].end() , std::greater<pll>()); while (e[i].size()>SQ) { e[i].pob(); } if (e[i].size()<SQ) { e[i].pb(mp(0 , i)); } } for(ll i=1;i<=q;i++) { ll t , y; cin>>t>>y; for(ll j=1;j<=y;j++) { ll x; cin>>x; z[x]=i; } if (y>SQ) { ll res=-1; dp[t]=0; for(ll j=t-1;j>=1;j--) { dp[j]=-1; for(ll u=0;u<out[j].size() && out[j][u]<=t;u++) { if (dp[out[j][u]]!=-1) { dp[j]=max(dp[j] , dp[out[j][u]]+1); } } if (z[j]!=i) { res=max(res , dp[j]); } } cout<<res<<endl; } else { bool flag=false; for(ll j=0;j<e[t].size();j++) { if (z[e[t][j].Y]!=i) { cout<<e[t][j].X<<endl; flag=true; break; } } if (!flag) { cout<<-1<<endl; } } } }

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

bitaro.cpp: In function 'int main()':
bitaro.cpp:50:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(ll j=0;j<in[i].size();j++)
              ~^~~~~~~~~~~~~
bitaro.cpp:54:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(ll u=0;u<e[v].size();u++)
               ~^~~~~~~~~~~~
bitaro.cpp:95:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(ll u=0;u<out[j].size() && out[j][u]<=t;u++)
                ~^~~~~~~~~~~~~~
bitaro.cpp:115:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(ll j=0;j<e[t].size();j++)
               ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...