Submission #656091

# Submission time Handle Problem Language Result Execution time Memory
656091 2022-11-06T09:41:37 Z aebov Bitaro’s Party (JOI18_bitaro) C++17
14 / 100
2000 ms 6368 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<queue>
#include<utility>
#define F first
#define S second
#define pb push_back
using namespace std;

const int N = (int)1e5 + 5;
int n , m, q, u, v, t, y, x, dp[N];
bool bad[N];
vector<int> adj[N];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m >> q;
	for(int i = 0; i < m; i ++){
		cin >> u >> v; 
		u --, v --;
		adj[v].pb(u);
	}
	while( q -- ){
		cin >> t >> y;
		for(int i = 0; i < n; i ++)dp[i] = bad[i] = 0;
		while(y --)cin >> x,x -- ,bad[x] = 1;
		for (int v = 0; v < t; v ++)
		{
			for(auto u: adj[v])dp[v] = max (dp[v], dp[u] + 1);
			if(dp[v] == 0 && bad[v])dp[v] = -1;
		}
		cout << dp[t-1] << endl;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 1 ms 2644 KB Output is correct
5 Correct 2 ms 2604 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 3 ms 2644 KB Output is correct
12 Correct 2 ms 2644 KB Output is correct
13 Correct 2 ms 2644 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2644 KB Output is correct
16 Correct 2 ms 2644 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 1 ms 2644 KB Output is correct
5 Correct 2 ms 2604 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 3 ms 2644 KB Output is correct
12 Correct 2 ms 2644 KB Output is correct
13 Correct 2 ms 2644 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2644 KB Output is correct
16 Correct 2 ms 2644 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 2 ms 2644 KB Output is correct
20 Correct 26 ms 3876 KB Output is correct
21 Correct 25 ms 3924 KB Output is correct
22 Correct 25 ms 3916 KB Output is correct
23 Correct 25 ms 3872 KB Output is correct
24 Correct 55 ms 5928 KB Output is correct
25 Correct 59 ms 5896 KB Output is correct
26 Correct 47 ms 5908 KB Output is correct
27 Correct 45 ms 6368 KB Output is correct
28 Correct 50 ms 6332 KB Output is correct
29 Correct 47 ms 6344 KB Output is correct
30 Correct 47 ms 6360 KB Output is correct
31 Correct 46 ms 6296 KB Output is correct
32 Correct 48 ms 6348 KB Output is correct
33 Correct 55 ms 5772 KB Output is correct
34 Correct 46 ms 5852 KB Output is correct
35 Correct 47 ms 5800 KB Output is correct
36 Correct 45 ms 5912 KB Output is correct
37 Correct 46 ms 5836 KB Output is correct
38 Correct 50 ms 5876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 1 ms 2644 KB Output is correct
5 Correct 2 ms 2604 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 3 ms 2644 KB Output is correct
12 Correct 2 ms 2644 KB Output is correct
13 Correct 2 ms 2644 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 2 ms 2644 KB Output is correct
16 Correct 2 ms 2644 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 2 ms 2644 KB Output is correct
19 Correct 2 ms 2644 KB Output is correct
20 Correct 26 ms 3876 KB Output is correct
21 Correct 25 ms 3924 KB Output is correct
22 Correct 25 ms 3916 KB Output is correct
23 Correct 25 ms 3872 KB Output is correct
24 Correct 55 ms 5928 KB Output is correct
25 Correct 59 ms 5896 KB Output is correct
26 Correct 47 ms 5908 KB Output is correct
27 Correct 45 ms 6368 KB Output is correct
28 Correct 50 ms 6332 KB Output is correct
29 Correct 47 ms 6344 KB Output is correct
30 Correct 47 ms 6360 KB Output is correct
31 Correct 46 ms 6296 KB Output is correct
32 Correct 48 ms 6348 KB Output is correct
33 Correct 55 ms 5772 KB Output is correct
34 Correct 46 ms 5852 KB Output is correct
35 Correct 47 ms 5800 KB Output is correct
36 Correct 45 ms 5912 KB Output is correct
37 Correct 46 ms 5836 KB Output is correct
38 Correct 50 ms 5876 KB Output is correct
39 Execution timed out 2043 ms 6064 KB Time limit exceeded
40 Halted 0 ms 0 KB -