Submission #982819

# Submission time Handle Problem Language Result Execution time Memory
982819 2024-05-14T18:40:43 Z vjudge1 Game (APIO22_game) C++17
2 / 100
3 ms 9816 KB
#include "game.h"

// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef int lli;
typedef pair<lli,lli> ii;
typedef vector<lli> vi;
typedef vector<ii> vii;
#define deb(x) cout << #x": " << (x) << endl;

const lli MAXN = 3e5 + 12;

lli val[MAXN];
lli vis[MAXN];

lli N, K;

vi adj[MAXN];

void push(int u){
  // deb(u);
  for (auto & v : adj[u]){
    bool y = false;
    if (vis[u] == 0 && u >= K) return;
    if (u < K){
      if (vis[v] == 0) vis[v] = u + 1, y = true;
      val[vis[v]] = min(val[vis[v]], u + 1);
    }
    else{
      if (vis[v] == 0) vis[v] = vis[u], y = true;
      val[vis[v]] = min(val[vis[v]], val[vis[u]]);
    }
    if (y) push(v);
  }
}

void init(int n, int k){
  N = n, K = k;
  fore(i,0,MAXN) val[i] = i;
  fore(i,0,K - 1) adj[i + 1].pb(i);
  push(K - 1);
}

int add_teleporter(int u, int v){
  swap(u, v);
  adj[u].pb(v);
  push(u);
  // fore(i,0,N) cout << vis[i] << ' '; cout << ENDL;
  // fore(i,0,N) cout << val[i] << ' '; cout << ENDL;
  fore(i,0,K) if ((val[vis[i]] - 1) <= i && val[vis[i]] > 0) return 1;
  return 0;
}

// int main(){ _
//   // freopen("file.in","r",stdin);
//   // freopen("file.out","w",stdout);
//   lli n, m, k; cin >> n >> m >> k;
//   init(n, k);
//   fore(i,0,m){
//     lli a, b; cin >> a >> b;
//     if (add_teleporter(a, b)) {cout << 1 << ENDL; return 0; }
//     else cout << 0 << ENDL;
//   }
//   return 0;
// }
# 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 3 ms 9816 KB Output is correct
4 Correct 3 ms 9816 KB Output is correct
5 Correct 3 ms 8536 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 3 ms 9816 KB Output is correct
4 Correct 3 ms 9816 KB Output is correct
5 Correct 3 ms 8536 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 8536 KB Output is correct
10 Correct 2 ms 9816 KB Output is correct
11 Incorrect 2 ms 8536 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 3 ms 9816 KB Output is correct
4 Correct 3 ms 9816 KB Output is correct
5 Correct 3 ms 8536 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 8536 KB Output is correct
10 Correct 2 ms 9816 KB Output is correct
11 Incorrect 2 ms 8536 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 3 ms 9816 KB Output is correct
4 Correct 3 ms 9816 KB Output is correct
5 Correct 3 ms 8536 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 8536 KB Output is correct
10 Correct 2 ms 9816 KB Output is correct
11 Incorrect 2 ms 8536 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 3 ms 9816 KB Output is correct
4 Correct 3 ms 9816 KB Output is correct
5 Correct 3 ms 8536 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 8536 KB Output is correct
10 Correct 2 ms 9816 KB Output is correct
11 Incorrect 2 ms 8536 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -