Submission #721478

#TimeUsernameProblemLanguageResultExecution timeMemory
721478nguyentunglamVision Program (IOI19_vision)C++17
58 / 100
55 ms2272 KiB
#include "vision.h" #include<bits/stdc++.h> using namespace std; const int N = 200 + 10; int row[N], col[N]; void construct_network(int h, int w, int K) { vector<int> lst; if (K == 1) { for(int i = 0; i < h; i++) { vector<int> ask; for(int j = 0; j < w; j++) ask.push_back(i * w + j); row[i] = add_or(ask); } for(int j = 0; j < w; j++) { vector<int> ask; for(int i = 0; i < h; i++) ask.push_back(i * w + j); col[j] = add_or(ask); } vector<int> R, C; for(int i = 0; i < h; i++) R.push_back(row[i]); for(int j = 1; j < w; j++) C.push_back(add_and({col[j], col[j - 1]})); if (!R.empty() && !C.empty()) { int ret = add_and({add_xor(R), add_or(C)}); lst.push_back(ret); } R.clear(); C.clear(); for(int j = 0; j < w; j++) C.push_back(col[j]); for(int i = 1; i < h; i++) R.push_back(add_and({row[i - 1], row[i]})); if (!R.empty() && !C.empty()) { int ret = add_and({add_xor(C), add_or(R)}); lst.push_back(ret); } int ok = add_or(lst); return; } for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) { vector<int> ask; for(int k = i; k < h; k++) for(int l = 0; l < w; l++) { if (i == k && j > l) continue; if (abs(i - k) + abs(j - l) == K) ask.push_back(k * w + l); } if (ask.empty()) continue; lst.push_back(add_and({i * w + j, add_or(ask)})); } if (lst.empty()) return; add_or(lst); }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:33:13: warning: unused variable 'ok' [-Wunused-variable]
   33 |         int ok = add_or(lst);
      |             ^~
#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...