# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
555016 | 2022-04-30T00:29:31 Z | slime | Vision Program (IOI19_vision) | C++14 | 5 ms | 1204 KB |
#include <bits/stdc++.h> #include "vision.h" #include <map> void construct_network(int H, int W, int K) { std::vector<int> Ns; std::vector<int> by_sum, by_diff; std::map<int, std::vector<int> > mp_sum, mp_diff; for(int i=0; i<H; i++) { for(int j=0; j<W; j++) { mp_sum[i + j].push_back(i*W + j); mp_diff[i - j].push_back(i*W + j); } } std::vector<int> analyze; // Necessary conditions, i.e. AND clause for(auto x: mp_sum) { by_sum.push_back(add_or(x.second)); } for(auto x: mp_diff) { by_diff.push_back(add_or(x.second)); } // Condition 1: at least one of these two arrays' 1s are exactly K cells apart std::vector<int> cond1; for(int i=0; i<by_sum.size(); i++) { if(i + K < by_sum.size()) { std::vector<int> uwu = {by_sum[i], by_sum[i + K]}; cond1.push_back(add_and(uwu)); } } for(int i=0; i<by_diff.size(); i++) { if(i + K < by_diff.size()) { std::vector<int> uwu = {by_diff[i], by_diff[i + K]}; cond1.push_back(add_and(uwu)); } } /* // Only one in cond1 array = 1 is necessary (but at least 1)! analyze.push_back(add_or(cond1)); // condition 2: [1 + K 0s] should not appear in any of them std::vector<int> cond2; for(int i=0; i<by_sum.size(); i++) { if(i + 1 + K < by_sum.size()) { std::vector<int> patt; // does this subarray match the pattern? std::vector<int> uwu = {by_sum[i]}; patt.push_back(add_and(uwu)); uwu.clear(); for(int j=i+1; j<i+1+K; j++) uwu.push_back(by_sum[j]); patt.push_back(add_not(add_or(uwu))); // Everything in patt = 1 iff by_sum[i] = 1 and all by_sum[i+1] to by_sum[i+K] = 0 cond2.push_back(add_and(patt)); // = 1 if match pattern, = 0 otherwise } } //analyze.push_back(add_not(add_or(cond2))); // = 1 if all cond2 = 0, i.e. no pattern found */ add_and(analyze); // answer }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | WA in grader: Instruction with no inputs |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | WA in grader: Instruction with no inputs |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | WA in grader: Instruction with no inputs |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | WA in grader: Instruction with no inputs |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | WA in grader: Instruction with no inputs |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | WA in grader: Instruction with no inputs |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 1204 KB | WA in grader: Instruction with no inputs |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | WA in grader: Instruction with no inputs |
2 | Halted | 0 ms | 0 KB | - |