Submission #494068

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4940682021-12-14 07:57:55ntabc05101Tropical Garden (IOI11_garden)C++14
100 / 100
117 ms41216 KiB
#include<bits/stdc++.h>
#include "garden.h"
#include "gardenlib.h"
using namespace std;
#define taskname ""
/*void answer(int res) {
cout << res << "\n";
}*/
void count_routes(int N, int M, int P, int R[][2], int Q, int G[]) {
vector<int> nxt(N << 1, -1);
for (int i = 0; i < M; i++) {
bool f[] = {!(~nxt[R[i][0] << 1]), !(~nxt[R[i][1] << 1])};
for (bool e: {0, 1}) {
int &u = R[i][e], &v = R[i][e ^ 1];
if (!(~nxt[u << 1])) {
nxt[u << 1] = v << 1 | f[e ^ 1];
}
else {
if (!(~nxt[u << 1 | 1])) {
nxt[u << 1 | 1] = v << 1 | f[e ^ 1];
}
}
}
}
for (int i = 0; i < N; i++) {
if (!(~nxt[i << 1])) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...