이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int h, w, k;
int cw;
int pnt(int x, int y)
{
return x + (y * w);
}
int has2(vi v)
{
return add_and({ add_or(v), add_not(add_xor(v)) });
} // 4 puertas
int hasmultiple(vi v)
{
int res = add_xor({ 0, 0 });
int prev = v[0];
for (int i = 1; i < v.size(); i++) {
res = add_or({ res, add_and({ prev, v[i] }) });
prev = add_or({ prev, v[i] });
}
return res;
}
void construct_network(int H, int W, int K)
{
h = H;
w = W;
k = K;
vi d1;
for (int d = -201; d < 202; d++) {
vi th;
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
if (abs(i - j + d) <= k && i - j + d <= 0)
th.push_back(pnt(i, j));
if (th.size())
d1.push_back(has2(th));
}
vi d2;
for (int d = -201; d < 202; d++) {
vi th;
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
if (abs(i + j + d) <= k && i + j + d <= 0)
th.push_back(pnt(i, j));
if (th.size())
d2.push_back(has2(th));
}
int tc = add_and({ hasmultiple(d1), hasmultiple(d2) });
int nf = add_and({ add_or(d1), add_or(d2) });
add_and({ nf, add_not(tc) });
}
컴파일 시 표준 에러 (stderr) 메시지
vision.cpp: In function 'int hasmultiple(vi)':
vision.cpp:24:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for (int i = 1; i < v.size(); i++) {
| ~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |