Submission #1331507

#TimeUsernameProblemLanguageResultExecution timeMemory
1331507al95ireyizGame (IOI14_game)C++20
0 / 100
1 ms344 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define len(x) (ll)x.size()
const ll inf = 1e9, infl = 1e18;
const ll MOD = 1e9 + 7;
const ll maxn = 2e3 + 5;
ll n, m, k = 0;

#include "game.h"

ll a[maxn][maxn], sz[maxn];
vll build(ll l = 0, ll r = n - 1){
  if(l == r) return {l};
  
  ll md = (l + r) >> 1;
  vll g = build(l, md), g_ = build(md + 1, r);
  k ++;
  for(auto x : g) for(auto y : g_){
    a[x][y] = a[y][x] = k;
  }
  for(auto y : g_) g.push_back(y);
  return g;
}
void initialize(int _n){
  n = _n;
  // 0  1  2  3
  // \  /  \  /
  //  v1    v2
  //   \    /
  //     v3

  build();
  for(ll i = 1; i <= n; i ++){
    for(ll j = i + 1; j <= n; j ++){
      sz[a[i][j]] ++;
    }
  }
}

int hasEdge(int u, int v){
  ll x = a[u][v];
  if(!sz[x]) return 0;
  sz[x] --;
  return 1;
}

// void _() {
  
// }
// signed main() {
//   cin.tie(0)->sync_with_stdio(0);
//   ll t = 1;
//   // cin >> t;
//   while(t --) _();
// }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...