Submission #298930

#TimeUsernameProblemLanguageResultExecution timeMemory
298930kevleeVision Program (IOI19_vision)C++17
100 / 100
93 ms8352 KiB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define inf 1000000000
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a))
#define all(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
vi diag[500], diag2[500];
int diag_one[500], diag_two[500], diag2_one[500], diag2_two[500];
void construct_network(int h, int w, int k) {
  FOR(i, 0, h-1) {
    FOR(j, 0, w-1) {
      diag[i+j].pb(i*w+j);
      diag2[i+w-1-j].pb(i*w+j);
    }
  }
  FOR(i, 0, h+w-2) {
    diag_one[i] = add_or(diag[i]);
    diag2_one[i] = add_or(diag2[i]);
    diag_two[i] = add_xor({add_xor(diag[i]), add_or(diag[i])});
    diag2_two[i] = add_xor({add_xor(diag2[i]), add_or(diag2[i])});
  }
  vi one, two;
  for (int j = 0; j + k <= h + w - 2; j++) {
    vi query, ones;
    FOR(l, j, j + k) {
      query.pb(diag_two[l]);
      ones.pb(diag_one[l]);
    }
    query.pb(add_xor({add_xor(ones), add_or(ones)}));
    one.pb(add_or(query));
  }
  for (int j = 0; j + k <= h + w - 2; j++) {
    vi query, ones;
    FOR(l, j, j + k) {
      query.pb(diag2_two[l]);
      ones.pb(diag2_one[l]);
    }
    query.pb(add_xor({add_xor(ones), add_or(ones)}));
    two.pb(add_or(query));
  }
  int id = add_and({add_or(one), add_or(two)});
  //----
  one.clear();
  two.clear();
  if (k == 1) {
    return;
  }
  k--;
  for (int j = 0; j + k <= h + w - 2; j++) {
    vi query, ones;
    FOR(l, j, j + k) {
      query.pb(diag_two[l]);
      ones.pb(diag_one[l]);
    }
    query.pb(add_xor({add_xor(ones), add_or(ones)}));
    one.pb(add_or(query));
  }
  for (int j = 0; j + k <= h + w - 2; j++) {
    vi query, ones;
    FOR(l, j, j + k) {
      query.pb(diag2_two[l]);
      ones.pb(diag2_one[l]);
    }
    query.pb(add_xor({add_xor(ones), add_or(ones)}));
    two.pb(add_or(query));
  }
  int id2 = add_and({add_or(one), add_or(two)});
  add_and({id, add_not(id2)});
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...