# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
737753 | 2023-05-07T16:58:14 Z | rominanafu | Tropical Garden (IOI11_garden) | C++11 | 5000 ms | 1876 KB |
#include "garden.h" #include "gardenlib.h" #include <bits/stdc++.h> #define pii pair<int,int> using namespace std; pii sig[150005]; int caso, resp; int cant_rutas(int ant, int act, int sum, int fin) { if (act == fin && sum == caso) return 1; if (sum > caso) return 0; int r=0; if (sig[act].first != ant || sig[act].second == -1) r = cant_rutas(act, sig[act].first, sum+1, fin); else r = cant_rutas(act, sig[act].second, sum+1, fin); return r; } void count_routes(int n, int m, int fin, int R[][2], int queries, int G[]) { memset(sig, -1, sizeof(sig)); int a, b; for(int i=0; i<m; i++) { a = R[i][0]; b = R[i][1]; if (sig[a].first == -1) { sig[a].first = b; } else if (sig[a].second == -1) { sig[a].second = b; } if (sig[b].first == -1) { sig[b].first = a; } else if (sig[b].second == -1) { sig[b].second = a; } } for(int i=0; i<queries; i++) { caso = G[i]; resp = 0; for(int i=0; i<n; i++) { resp += cant_rutas(-1, i, 0, fin); } answer(resp); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1492 KB | Output is correct |
2 | Correct | 2 ms | 1492 KB | Output is correct |
3 | Correct | 1 ms | 1476 KB | Output is correct |
4 | Correct | 1 ms | 1492 KB | Output is correct |
5 | Correct | 1 ms | 1492 KB | Output is correct |
6 | Correct | 2 ms | 1492 KB | Output is correct |
7 | Correct | 1 ms | 1492 KB | Output is correct |
8 | Correct | 2 ms | 1460 KB | Output is correct |
9 | Correct | 2 ms | 1540 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1492 KB | Output is correct |
2 | Correct | 2 ms | 1492 KB | Output is correct |
3 | Correct | 1 ms | 1476 KB | Output is correct |
4 | Correct | 1 ms | 1492 KB | Output is correct |
5 | Correct | 1 ms | 1492 KB | Output is correct |
6 | Correct | 2 ms | 1492 KB | Output is correct |
7 | Correct | 1 ms | 1492 KB | Output is correct |
8 | Correct | 2 ms | 1460 KB | Output is correct |
9 | Correct | 2 ms | 1540 KB | Output is correct |
10 | Correct | 4 ms | 1492 KB | Output is correct |
11 | Execution timed out | 5014 ms | 1876 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1492 KB | Output is correct |
2 | Correct | 2 ms | 1492 KB | Output is correct |
3 | Correct | 1 ms | 1476 KB | Output is correct |
4 | Correct | 1 ms | 1492 KB | Output is correct |
5 | Correct | 1 ms | 1492 KB | Output is correct |
6 | Correct | 2 ms | 1492 KB | Output is correct |
7 | Correct | 1 ms | 1492 KB | Output is correct |
8 | Correct | 2 ms | 1460 KB | Output is correct |
9 | Correct | 2 ms | 1540 KB | Output is correct |
10 | Correct | 4 ms | 1492 KB | Output is correct |
11 | Execution timed out | 5014 ms | 1876 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |