Submission #1118550

# Submission time Handle Problem Language Result Execution time Memory
1118550 2024-11-25T16:33:35 Z adaawf Vision Program (IOI19_vision) C++17
12 / 100
36 ms 6152 KB
#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
void construct_network(int h, int w, int k) {
    if (min(h, w) == 1) {
        vector<int> va;
        for (int i = 0; i < max(h, w) - k; i++) {
            vector<int> vv;
            vv.push_back(i);
            vv.push_back(i + k);
            va.push_back(add_and(vv));
        }
        add_or(va);
        return;
    }
    int x = 0, y = 0;
    vector<int> va;
    for (int i = 0; i <= 15; i++) {
        vector<int> v;
        for (int j = 0; j < h * w; j++) {
            if (j & (1 << i)) {
                v.push_back(j);
            }
        }
        if (v.empty()) continue;
        if (add_or(v)) {
            if (add_xor(v)) va.push_back(i);
            else {
                x += (1 << i);
                y += (1 << i);
            }
        }
    }
    for (int i = 0; i < (1 << va.size()); i++) {
        int z = x, t = y;
        for (int j = 0; j < va.size(); j++) {
            if (i & (1 << j)) z += (1 << va[j]);
            else t += (1 << va[j]);
        }
        if (z < 0 || t < 0 || z >= h * w || t >= h * w || z > t) continue;
        int u = z / w, v = z % w, uu = t / w, vv = t % w;
        if (abs(uu - u) + abs(vv - v) != k) continue;
        vector<int> vva;
        vva.push_back(z);
        vva.push_back(t);
        if (add_and(vva)) {
            return;
        }
    }
    vector<int> vva;
    vva.push_back(0);
    vva.push_back(1);
    add_or(vva);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:36:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         for (int j = 0; j < va.size(); j++) {
      |                         ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 2 ms 352 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Incorrect 2 ms 352 KB on inputs (0, 1), (1, 0), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 2 ms 352 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Incorrect 2 ms 352 KB on inputs (0, 1), (1, 0), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 2 ms 352 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Incorrect 2 ms 352 KB on inputs (0, 1), (1, 0), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 2 ms 352 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Incorrect 2 ms 352 KB on inputs (0, 1), (1, 0), expected 0, but computed 1
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 1 ms 456 KB Output is correct
4 Correct 1 ms 608 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 2 ms 608 KB Output is correct
13 Correct 1 ms 352 KB Output is correct
14 Correct 1 ms 352 KB Output is correct
15 Correct 1 ms 352 KB Output is correct
16 Correct 1 ms 352 KB Output is correct
17 Correct 1 ms 352 KB Output is correct
18 Correct 1 ms 352 KB Output is correct
19 Correct 1 ms 352 KB Output is correct
20 Correct 1 ms 352 KB Output is correct
21 Correct 1 ms 352 KB Output is correct
22 Correct 1 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 6152 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 352 KB Output is correct
3 Correct 2 ms 352 KB Output is correct
4 Correct 1 ms 500 KB Output is correct
5 Incorrect 2 ms 352 KB on inputs (0, 1), (1, 0), expected 0, but computed 1
6 Halted 0 ms 0 KB -