Submission #899660

# Submission time Handle Problem Language Result Execution time Memory
899660 2024-01-06T20:14:40 Z Macker Tropical Garden (IOI11_garden) C++17
49 / 100
5000 ms 3920 KB
#include "garden.h"
#include "gardenlib.h"
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")

vector<vector<int>> adj;
int t;

bool up(int a, int p, int s){
    if(s == 0) return a == t;
    if(adj[a].size() > 1 && adj[a][0] == p) return up(adj[a][1], a, --s);
    else return up(adj[a][0], a, --s);
}

void count_routes(int N, int M, int P, int R[][2], int Q, int G[])
{
    t = P;
    adj.assign(N, vector<int>());
    for (int i = 0; i < M; i++) {
        adj[R[i][0]].push_back(R[i][1]);
        adj[R[i][1]].push_back(R[i][0]);
    }
    for (int j = 0; j < Q; j++) {
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            cnt += up(i, -1, G[j]);
        }
        answer(cnt);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 616 KB Output is correct
10 Correct 4 ms 344 KB Output is correct
11 Execution timed out 5022 ms 3920 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 616 KB Output is correct
10 Correct 4 ms 344 KB Output is correct
11 Execution timed out 5022 ms 3920 KB Time limit exceeded
12 Halted 0 ms 0 KB -