Submission #298922

#TimeUsernameProblemLanguageResultExecution timeMemory
298922kevleeVision Program (IOI19_vision)C++17
58 / 100
102 ms8312 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];
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);
    }
  }
  vi one, two;
    for (int j = 0; j + k <= h + w - 2; j++) {
      vi query;
      FOR(l, j, j + k) {
        for (auto it: diag[l]) query.pb(it);
      }
      one.pb(add_xor({add_xor(query), add_or(query)}));
    }
    for (int j = 0; j + k <= h + w - 2; j++) {
      vi query;
      FOR(l, j, j + k) {
        for (auto it: diag2[l]) query.pb(it);
      }
      two.pb(add_xor({add_xor(query), 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;
      FOR(l, j, j + k) {
        for (auto it: diag[l]) query.pb(it);
      }
      one.pb(add_xor({add_xor(query), add_or(query)}));
    }
    for (int j = 0; j + k <= h + w - 2; j++) {
      vi query;
      FOR(l, j, j + k) {
        for (auto it: diag2[l]) query.pb(it);
      }
      two.pb(add_xor({add_xor(query), 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...