Submission #200563

#TimeUsernameProblemLanguageResultExecution timeMemory
200563arnold518Vision Program (IOI19_vision)C++14
100 / 100
27 ms2292 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 400; int H, W, K, A[MAXN+10], B[MAXN+10]; int get(int y, int x) { y--; x--; return W*y+x; } int solve(int K) { int i, j, p, q, x, y; vector<int> t, tt; for(p=2; p<=H+W; p++) { t.clear(); for(i=max(1, p-W); i<=min(p-1, H); i++) { j=p-i; t.push_back(get(i, j)); } A[p]=add_or(t); } for(p=2; p<=H+W; p++) { if(p==2) B[p]=A[p]; else B[p]=add_or({A[p], B[p-1]}); } tt.clear(); for(p=K+2; p<=H+W; p++) { tt.push_back(add_and({B[p-K], A[p]})); } x=add_or(tt); for(p=1-W; p<=H-1; p++) { t.clear(); for(i=max(1, p+1); i<=min(H, W+p); i++) { j=i-p; t.push_back(get(i, j)); } A[p+W]=add_or(t); } for(p=1-W; p<=H-1; p++) { if(p==1-W) B[p+W]=A[p+W]; else B[p+W]=add_or({A[p+W], B[p-1+W]}); } tt.clear(); for(p=1-W+K; p<=H-1; p++) { tt.push_back(add_and({B[p-K+W], A[p+W]})); } y=add_or(tt); return add_or({x, y}); } void construct_network(int _H, int _W, int _K) { int i, j, p, q; H=_H; W=_W; K=_K; if(K==H+W-2) { solve(K); return; } int x=solve(K), y=solve(K+1); add_xor({x, y}); }

Compilation message (stderr)

vision.cpp: In function 'int solve(int)':
vision.cpp:21:15: warning: unused variable 'q' [-Wunused-variable]
  int i, j, p, q, x, y;
               ^
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:74:6: warning: unused variable 'i' [-Wunused-variable]
  int i, j, p, q;
      ^
vision.cpp:74:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j, p, q;
         ^
vision.cpp:74:12: warning: unused variable 'p' [-Wunused-variable]
  int i, j, p, q;
            ^
vision.cpp:74:15: warning: unused variable 'q' [-Wunused-variable]
  int i, j, p, q;
               ^
#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...