Submission #974633

# Submission time Handle Problem Language Result Execution time Memory
974633 2024-05-03T14:44:31 Z IUA_Hasin Game (APIO22_game) C++17
2 / 100
3 ms 9816 KB
#include "game.h"

#include <bits/stdc++.h>

#define endl                            "\n"
#define ll                              long long

using namespace std;

const ll N = 3e5+10;
ll NN, K;
std::vector<ll> graph[N];

ll vis[N];
ll vis2[N];

void dfs(ll vertex){
    if(vis[vertex]==1){
        return; 
    } else {
        vis[vertex] = 1;
        // cout << vertex << " ";
        for(auto u : graph[vertex]){
            dfs(u);
        }
        return;
    }
}


void init(int n, int k) {
  NN = n;
  K = k;
  for(int i=0; i<=k-2; i++){
    graph[i].push_back(i+1);
    // cout << i << " " << i+1 << endl;
  }
}


int add_teleporter(int u, int v) {
  graph[u].push_back(v);
  for(int i=0; i<=NN+5; i++){
    vis[i] = 0;
  }
  dfs(0);

  std::vector<ll> last;
  for(int i=0; i<=NN+5; i++){
    if(vis[i]==1){
      last.push_back(i);
      // cout<<i<<" ";
    }
  }
  cout<<endl;

  if(u>=K && v<K){
    vis2[u] = 1;
    // cout << u << " " << 59 << endl;
  }

  if(u>=v && u<K){
    return 1;
  } else {
    for(int i=0; i<last.size(); i++){
      if(vis2[last[i]]==1){
        return 1;
      }
    }
    return 0;
  }
    


}

Compilation message

game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:65:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |     for(int i=0; i<last.size(); i++){
      |                  ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 9816 KB Output is correct
2 Correct 3 ms 9816 KB Output is correct
3 Correct 2 ms 9816 KB Output is correct
4 Correct 2 ms 9816 KB Output is correct
5 Correct 3 ms 9816 KB Output is correct
6 Correct 3 ms 9816 KB Output is correct
7 Correct 2 ms 9816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 9816 KB Output is correct
2 Correct 3 ms 9816 KB Output is correct
3 Correct 2 ms 9816 KB Output is correct
4 Correct 2 ms 9816 KB Output is correct
5 Correct 3 ms 9816 KB Output is correct
6 Correct 3 ms 9816 KB Output is correct
7 Correct 2 ms 9816 KB Output is correct
8 Correct 2 ms 9816 KB Output is correct
9 Correct 2 ms 9720 KB Output is correct
10 Correct 2 ms 9816 KB Output is correct
11 Incorrect 2 ms 9816 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 9816 KB Output is correct
2 Correct 3 ms 9816 KB Output is correct
3 Correct 2 ms 9816 KB Output is correct
4 Correct 2 ms 9816 KB Output is correct
5 Correct 3 ms 9816 KB Output is correct
6 Correct 3 ms 9816 KB Output is correct
7 Correct 2 ms 9816 KB Output is correct
8 Correct 2 ms 9816 KB Output is correct
9 Correct 2 ms 9720 KB Output is correct
10 Correct 2 ms 9816 KB Output is correct
11 Incorrect 2 ms 9816 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 9816 KB Output is correct
2 Correct 3 ms 9816 KB Output is correct
3 Correct 2 ms 9816 KB Output is correct
4 Correct 2 ms 9816 KB Output is correct
5 Correct 3 ms 9816 KB Output is correct
6 Correct 3 ms 9816 KB Output is correct
7 Correct 2 ms 9816 KB Output is correct
8 Correct 2 ms 9816 KB Output is correct
9 Correct 2 ms 9720 KB Output is correct
10 Correct 2 ms 9816 KB Output is correct
11 Incorrect 2 ms 9816 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 9816 KB Output is correct
2 Correct 3 ms 9816 KB Output is correct
3 Correct 2 ms 9816 KB Output is correct
4 Correct 2 ms 9816 KB Output is correct
5 Correct 3 ms 9816 KB Output is correct
6 Correct 3 ms 9816 KB Output is correct
7 Correct 2 ms 9816 KB Output is correct
8 Correct 2 ms 9816 KB Output is correct
9 Correct 2 ms 9720 KB Output is correct
10 Correct 2 ms 9816 KB Output is correct
11 Incorrect 2 ms 9816 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -