# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
345057 | casperwang | Tropical Garden (IOI11_garden) | C++14 | 5065 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <garden.h>
#include <gardenlib.h>
#define All(x) x.begin(), x.end()
#define pb emplace_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define ff first
#define ss second
using namespace std;
#define debug(args...) kout("[ " + string(#args) + " ]", args)
void kout() { cerr << endl; }
template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); }
template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; }
const int MAXN = 150000;
const int MAXQ = 2000;
void count_routes(int N, int M, int P, int R[MAXN][2], int Q, int G[MAXQ]) {
vector<vector<ppi>> path(N);
for (int i = 0; i < M; i++) {
path[R[i][0]].pb(pii(0, i), R[i][1]);
path[R[i][1]].pb(pii(0, i), R[i][0]);
}
vector <pii> K(Q);
for (int i = 0; i < Q; i++) {
K[i].ff = G[i];
K[i].ss = i;
}
sort(All(K));
int now = 0;
vector <int> ans(N);
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
for (int k = 0; k < path[j].size(); k++) {
path[j][k].ff.ff = 0;
}
}
int cur = i;
for (int q = 0; q < Q; q++) {
while (now < K[q].ff) {
sort(All(path[cur]));
path[cur][0].ff.ff++;
cur = path[cur][0].ss;
}
now++;
if (cur == P) ans[K[q].ss]++;
}
}
for (int q = 0; q < Q; q++) {
answer(ans[q]);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |