Submission #1021526

# Submission time Handle Problem Language Result Execution time Memory
1021526 2024-07-12T19:11:14 Z vjudge1 Vision Program (IOI19_vision) C++17
0 / 100
2 ms 984 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using vi = vector <int>;

void construct_network (int h, int w, int k) {
    vi th;
    auto toLine = [&](ll i, ll j) { return 0 <= i && i < h && 0 <= j && j < w ? i*w+j : -16; };
    auto getNeigh = [&](ll i, ll j) -> vi {
        vi ans;
        if (toLine(i-1, j) != -16) ans.push_back(toLine(i-1, j));
        if (toLine(i+1, j) != -16) ans.push_back(toLine(i+1, j));
        if (toLine(i, j-1) != -16) ans.push_back(toLine(i, j-1));
        if (toLine(i, j+1) != -16) ans.push_back(toLine(i, j+1));
        return ans;
    };
    for (ll i = 0; i < h; i++) {
        for (ll j = 0; j < w; j++) {
            th.push_back(add_and({ toLine(i, j), add_or({ getNeigh(i, j) }) }));
        }
    }
    add_or(th);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:21:42: warning: narrowing conversion of 'toLine.construct_network(int, int, int)::<lambda(ll, ll)>(i, j)' from 'long long int' to 'int' [-Wnarrowing]
   21 |             th.push_back(add_and({ toLine(i, j), add_or({ getNeigh(i, j) }) }));
      |                                    ~~~~~~^~~~~~
vision.cpp:21:42: warning: narrowing conversion of 'toLine.construct_network(int, int, int)::<lambda(ll, ll)>(i, j)' from 'long long int' to 'int' [-Wnarrowing]
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 984 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -