## Submission #347987

# Submission time Handle Problem Language Result Execution time Memory
347987 2021-01-14T02:03:39 Z milleniumEeee Tropical Garden (IOI11_garden) C++17
0 / 100
9 ms 11500 KB
```/*
ребра как вершины
*/
#include "garden.h"
#include "gardenlib.h"
#include <bits/stdc++.h>
#define pii pair<int, int>
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define szof(s) (int)s.size()
using namespace std;

const int MAXN = 150005;
int n, m, q, p;
vector <pii> edges;
vector <pii> g[MAXN];
map <pii, int> mp;
vector <int> eg[MAXN * 2]; // edge graph
pii from_to[MAXN * 2];
int table[31][MAXN * 2];

int get(int v, int k) {
int cur = v;
for (int i = 30; i >= 0; i--) {
if (k & (1 << i)) {
cur = table[i][cur];
}
}
return cur;
}

int solve(int k) {
int ans = 0;
for (int i = 0; i < n; i++) {
int ind = get(g[i][0].sc, k - 1);
if (from_to[ind].sc == p) {
ans++;
}
}
return ans;
}

void count_routes(int N, int M, int P, int R[][2], int Q, int G[]) {
n = N;
m = M;
q = Q;
p = P;
for (int i = 0; i < m; i++) {
int x = R[i][0];
int y = R[i][1];
edges.pb({x, y});
if (szof(g[x]) < 2) {
g[x].pb({y, i});
}
if (szof(g[y]) < 2) {
g[y].pb({x, i});
}
}
int cnt = 0;
for (int v = 0; v < n; v++) {
for (auto edge : g[v]) {
int to = edge.fr, ind = edge.sc;
mp[{v, to}] = cnt++;
from_to[cnt - 1] = {v, to};
}
}
int sz = 0;
for (int v = 0; v < n; v++) {
for (auto edge : g[v]) {
int to = edge.fr, ind = edge.sc;
sz++;
if (g[to][0].sc != ind) {
eg[mp[{v, to}]].push_back(mp[{to, g[to][0].fr}]);
continue;
}
if (szof(g[to]) > 1 && g[to][1].sc != ind) {
eg[mp[{v, to}]].push_back(mp[{to, g[to][1].fr}]);
continue;
}
if (szof(g[to]) == 1) {
eg[mp[{v, to}]].push_back(mp[{to, v}]);
continue;
}
}
}
for (int pw = 0; pw < 30; pw++) {
if (pw == 0) {
for (int v = 0; v < sz; v++) {
table[pw][v] = eg[v][0];
}
} else {
for (int v = 0; v < sz; v++) {
table[pw][v] = table[pw - 1][table[pw - 1][v]];
}
}
}
for (int i = 0; i < q; i++) {
}
}
```

### Compilation message

```garden.cpp: In function 'void count_routes(int, int, int, int (*)[2], int, int*)':
garden.cpp:65:25: warning: unused variable 'ind' [-Wunused-variable]
65 |       int to = edge.fr, ind = edge.sc;
|                         ^~~```

#### Subtask #1 0 / 49.0

# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 11500 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #2 0 / 20.0

# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 11500 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #3 0 / 31.0

# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 11500 KB Output isn't correct
2 Halted 0 ms 0 KB -