Submission #385559

#TimeUsernameProblemLanguageResultExecution timeMemory
385559SprdaloVision Program (IOI19_vision)C++17
Compilation error
0 ms0 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<double> vd; typedef vector<bool> vb; typedef vector<char> vc; typedef vector<string> vs; typedef vector<pi> vp; typedef vector<pl> vpl; /* int last; vi A; int add_not(int pos){ int n = A.size(); if (pos < 0 || pos >= n){ throw SIGSEGV; } if (A[pos]) last = 0; else last = 1; A.push_back(last); return last; } int add_and(vi t){ int n = A.size(); if (t.empty()) throw SIGSEGV; last = 1; for (int pos : t){ if (pos < 0 || pos >= n){ throw SIGSEGV; } last &= A[pos]; } A.push_back(last); return last; } int add_or(vi t){ int n = A.size(); if (t.empty()) {throw SIGSEGV;} last = 0; for (int pos : t){ if (pos < 0 || pos >= n) throw SIGSEGV; last |= A[pos]; } A.push_back(last); return last; } int add_xor(vi t){ int n = A.size(); if (t.empty()){ throw SIGSEGV;} last = 0; for (int pos : t){ if (pos < 0 || pos >= n){ throw SIGSEGV; } last ^= A[pos]; } A.push_back(last); return last; } */ void moze(int h, int w){ vi t; for (int i = 0; i < h*w; ++i){ t.push_back(i); } add_or(t); } void ne_moze(int h, int w){ vi t; for (int i = 0; i < h*w; ++i){ t.push_back(i); } add_xor(t); } vi ldor,ldx,rdor,rdx; bool check(int k, int h, int w){ bool ok = 0; for (int i = 0; i < h+w-1; ++i){ vi tor, tx; if (i + k > h+w-1) break; for (int j = i; j < i+k; ++j){ tor.push_back(ldor[j]); tx.push_back(ldx[j]); } if (add_or(tor) == 1 && add_xor(tx) == 0){ ok = 1; break; } } if (!ok) return 0; ok = 0; for (int i = 0; i < h+w-1; ++i){ vi tor, tx; if (i + k > h+w-1) break; for (int j = i; j < i+k; ++j){ tor.push_back(rdor[j]); tx.push_back(rdx[j]); } if (add_or(tor) == 1 && add_xor(tx) == 0){ ok = 1; break; } } return ok; } void construct_network(int h, int w, int k){ vector<vi> l(h+w-1), r(h+w-1); int n = A.size(); for (int i = 0; i < h; ++i){ for (int j = 0; j < w; ++j){ l[i+j].push_back(i*w+j); } } for (int i = 0; i < h; ++i){ for (int j = 0; j < w; ++j){ r[i-j+w-1].push_back(i*w+j); } } ldor.clear(); ldx.clear(); int cur = 0; for (int i = 0; i < h+w-1; ++i){ add_or(l[i]); ldor.push_back(h*w+cur); ++cur; add_xor(l[i]); ldx.push_back(h*w+cur); ++cur; } rdor.clear(); rdx.clear(); for (int i = 0; i < h+w-1; ++i){ add_or(r[i]); rdor.push_back(h*w+cur); ++cur; add_xor(r[i]); rdx.push_back(h*w+cur); ++cur; } if (check(k+1,h,w) && !check(k,h,w)){ moze(h,w); } else { ne_moze(h,w); } } /* signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr); int h, w, k; cin >> h >> w >> k; A = vi(h*w,0); int q; cin >> q; int x1=0, y1=0, x2=0, y2=0; for (int e = 0; e < q; ++e){ A[x1*w+y1] = A[x2*w+y2] = 0; cin >> x1 >> y1 >> x2 >> y2; A[x1*w+y1] = A[x2*w+y2] = 1; last = -1; construct_network(h,w,k); cout << last << '\n'; } }*/

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:145:13: error: 'A' was not declared in this scope
  145 |     int n = A.size();
      |             ^
vision.cpp:145:9: warning: unused variable 'n' [-Wunused-variable]
  145 |     int n = A.size();
      |         ^