Submission #424880

#TimeUsernameProblemLanguageResultExecution timeMemory
424880madlogicVision Program (IOI19_vision)C++17
44 / 100
19 ms3764 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; // int cur; // int add_xor(vector<int> v) { // cout << "XOR" << endl; // for (int p : v) { // cout << p << ' '; // } // cout << '\n'; // return ++cur; // } // int add_or(vector<int> v) { // cout << "OR" << endl; // for (int p : v) { // cout << p << " "; // } // cout << '\n'; // return ++cur; // } // int add_and(vector<int> v) { // cout << "AND" << endl; // for (int p : v) { // cout << p << ' '; // } // cout << '\n'; // return ++cur; // } void construct_network(int H, int W, int K) { // cur = (H - 1) * W + (W - 1); vector<vector<vector<int>>> dp(3, vector<vector<int>>(H, vector<int>(W, -1))); for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { vector<int> v{i * W + j}; for (int x = 0; x <= K; x++) { int y = K - x; set<int> s; s.insert(y); s.insert(-y); for (int ys : s) { int dx = i + x; int dy = j + ys; if (dx >= 0 && dx < H && dy >= 0 && dy < W) { int yy = dx * W + dy; v.push_back(yy); } } } dp[0][i][j] = add_xor(v); dp[1][i][j] = add_or(v); reverse(v.begin(), v.end()); v.pop_back(); if (!v.empty()) { dp[2][i][j] = add_xor(v); } } } vector<int> v; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { int a = dp[0][i][j]; int b = dp[1][i][j]; if (dp[2][i][j] != -1) { int id1 = add_xor({a, b}); int idx = add_and({id1, dp[2][i][j]}); v.push_back(idx); } } } if (!v.empty()) { add_or(v); } else { add_or({0}); } } // int main() { // ios::sync_with_stdio(false); // cin.tie(0); // construct_network(3, 3, 2); // return 0; // }
#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...