Submission #592423

# Submission time Handle Problem Language Result Execution time Memory
592423 2022-07-09T07:43:08 Z fuad27 Tropical Garden (IOI11_garden) C++17
49 / 100
5 ms 856 KB
#include "garden.h"
#include "gardenlib.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 1010;
vector<int> g[N];
bool check(int at,int e, int k) {
	int p=at;
	for(int i = 0;i<k;i++) {
		if(g[at].size()>1 and g[at][0]==p) {
			p=at;
			at=g[at][1];
		}
		else {
			p=at;
			at=g[at][0];
		}
	}
	if(at==e)return true;
	return false;
}
void count_routes(int N, int M, int P, int R[][2], int Q, int G[]) {
	for(int i = 0;i<M;i++) {
		g[R[i][0]].push_back(R[i][1]);
		g[R[i][1]].push_back(R[i][0]);
	}
	for(int i = 0;i<Q;i++) {
		int ans=0;
		for(int j = 0;j<N;j++) {
			if(check(j, P, G[i])){
				ans++;
			}
		}
		answer(ans);
	}
}


# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 380 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 380 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 5 ms 340 KB Output is correct
11 Runtime error 5 ms 856 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 380 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 5 ms 340 KB Output is correct
11 Runtime error 5 ms 856 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -