Submission #987178

#TimeUsernameProblemLanguageResultExecution timeMemory
987178gvancakBitaro’s Party (JOI18_bitaro)C++11
0 / 100
2077 ms23900 KiB
/* LANG: C++ PROBLEM: */#include <bits/stdc++.h> #define f first #define s second #define pb push_back #define mp make_pair #define ll long long using namespace std; ll mod=1e9+7; ll a[1000005],b[1000005],l,x,y,z,r,ans[1000005],ans1,t,n,mx,k,ind1,ind2,ind3,m,q; vector <ll> v[1000005]; pair <ll,ll> p[1000005]; pair <ll, pair<ll,ll> > p1[1000005]; string s,s1; bool ok; void gvanca(ll x,ll y){ if (x<y){ for (int i=0; i<v[x].size(); i++){ if (v[x][i]>y) continue; ans[v[x][i]]=max(ans[v[x][i]],ans[x]+1); if (v[x][i]==y) ans1=max(ans[v[x][i]],ans1); gvanca(v[x][i],y); } } } int main() { ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0); cin>>n>>m>>q; for (int i=1; i<=m; i++){ cin>>x>>y; v[x].pb(y); } while (q--){ cin>>x>>y; for (int i=1; i<=y; i++) { cin>>z; b[z]=1; } ans1=-1; for (int i=1; i<=x; i++){ if (b[i]==1) { b[i]=0;continue; }if (i==x) { ans1=max(ans1,0ll); continue; } z=0; ans[i]=0; // for (int j=i; j<=x; j++) ans[j]=0; gvanca(i,x); // cout<<ans1<<" "<<i<<endl; } cout<<ans1<<endl; } }

Compilation message (stderr)

bitaro.cpp: In function 'void gvanca(long long int, long long int)':
bitaro.cpp:20:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for (int i=0; i<v[x].size(); i++){
      |                 ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...