Submission #823079

# Submission time Handle Problem Language Result Execution time Memory
823079 2023-08-12T07:41:35 Z nemethm Tropical Garden (IOI11_garden) C++17
49 / 100
5000 ms 4944 KB
#include "garden.h"
#include "gardenlib.h"

#include <bits/stdc++.h>

using namespace std;

vector<pair<int,int>> g[150100];
int p;

int simulate(int node, int k){
  int prev = -1;
  while(k--){
    int nxt = g[node][0].first;
    if(nxt == prev && g[node].size() > 1){
      nxt = g[node][1].first;
    }
    prev = node;
    node = nxt;
  }
  return p == node;
}

void count_routes(int N, int M, int P, int R[][2], int Q, int G[])
{
  p = P;
  for(int i = 0; i < M; ++i){
    g[R[i][0]].push_back({R[i][1], i});   //nem kéne minden él
    g[R[i][1]].push_back({R[i][0], i});
  }
  int ans = 0;
  for(int i = 0; i < N; ++i){
    ans += simulate(i, G[0]);
  }
  answer(ans);
}


# Verdict Execution time Memory Grader output
1 Correct 3 ms 3836 KB Output is correct
2 Correct 2 ms 3796 KB Output is correct
3 Correct 2 ms 3836 KB Output is correct
4 Correct 2 ms 3832 KB Output is correct
5 Correct 2 ms 3796 KB Output is correct
6 Correct 3 ms 3924 KB Output is correct
7 Correct 2 ms 3832 KB Output is correct
8 Correct 2 ms 3796 KB Output is correct
9 Correct 4 ms 4104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3836 KB Output is correct
2 Correct 2 ms 3796 KB Output is correct
3 Correct 2 ms 3836 KB Output is correct
4 Correct 2 ms 3832 KB Output is correct
5 Correct 2 ms 3796 KB Output is correct
6 Correct 3 ms 3924 KB Output is correct
7 Correct 2 ms 3832 KB Output is correct
8 Correct 2 ms 3796 KB Output is correct
9 Correct 4 ms 4104 KB Output is correct
10 Correct 6 ms 3848 KB Output is correct
11 Execution timed out 5061 ms 4944 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3836 KB Output is correct
2 Correct 2 ms 3796 KB Output is correct
3 Correct 2 ms 3836 KB Output is correct
4 Correct 2 ms 3832 KB Output is correct
5 Correct 2 ms 3796 KB Output is correct
6 Correct 3 ms 3924 KB Output is correct
7 Correct 2 ms 3832 KB Output is correct
8 Correct 2 ms 3796 KB Output is correct
9 Correct 4 ms 4104 KB Output is correct
10 Correct 6 ms 3848 KB Output is correct
11 Execution timed out 5061 ms 4944 KB Time limit exceeded
12 Halted 0 ms 0 KB -