Submission #987177

# Submission time Handle Problem Language Result Execution time Memory
987177 2024-05-22T08:12:49 Z gvancak Bitaro’s Party (JOI18_bitaro) C++11
0 / 100
2000 ms 23968 KB
/*
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

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 time Memory Grader output
1 Correct 16 ms 23900 KB Output is correct
2 Correct 13 ms 23900 KB Output is correct
3 Correct 15 ms 23960 KB Output is correct
4 Correct 13 ms 23900 KB Output is correct
5 Correct 17 ms 23900 KB Output is correct
6 Correct 18 ms 23968 KB Output is correct
7 Correct 15 ms 23896 KB Output is correct
8 Execution timed out 2025 ms 23900 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 23900 KB Output is correct
2 Correct 13 ms 23900 KB Output is correct
3 Correct 15 ms 23960 KB Output is correct
4 Correct 13 ms 23900 KB Output is correct
5 Correct 17 ms 23900 KB Output is correct
6 Correct 18 ms 23968 KB Output is correct
7 Correct 15 ms 23896 KB Output is correct
8 Execution timed out 2025 ms 23900 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 23900 KB Output is correct
2 Correct 13 ms 23900 KB Output is correct
3 Correct 15 ms 23960 KB Output is correct
4 Correct 13 ms 23900 KB Output is correct
5 Correct 17 ms 23900 KB Output is correct
6 Correct 18 ms 23968 KB Output is correct
7 Correct 15 ms 23896 KB Output is correct
8 Execution timed out 2025 ms 23900 KB Time limit exceeded
9 Halted 0 ms 0 KB -