이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
const int N = 4010;
int h, w, k;
int n;
int get_n(int x, int y) { return 0 <= x && x < h && 0 <= y && y < w? x*w + y: -1;}
vector<int> nbr[N];
void construct_network(int H, int W, int K)
{
h = H; w = W; k = K;
n = w*h;
Loop (i,0,h) Loop (j,0,w) {
Loop (c,0,k) {
int x, y;
x = i+k; y = j;
x -= c; y += c;
if (get_n(x, y) >= 0)
nbr[get_n(i, j)].push_back(get_n(x, y));
x = i; y = j+k;
x -= c; y -= c;
if (get_n(x, y) >= 0)
nbr[get_n(i, j)].push_back(get_n(x, y));
x = i-k; y = j;
x += c; y -= c;
if (get_n(x, y) >= 0)
nbr[get_n(i, j)].push_back(get_n(x, y));
x = i; y = j-k;
x += c; y += c;
if (get_n(x, y) >= 0)
nbr[get_n(i, j)].push_back(get_n(x, y));
}
}
//Loop (i,0,n) {
// cout << i << ": ";
// for (int x : nbr[i])
// cout << x << ' ';
// cout << '\n';
//}
Loop (i,0,n)
nbr[i].size()? add_or(nbr[i]): add_not(i);
Loop (i,0,n)
add_and({i, n+i});
vector<int> kooft(n);
iota(kooft.begin(), kooft.end(), 2*n);
add_or(kooft);
}
컴파일 시 표준 에러 (stderr) 메시지
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:55:12: warning: narrowing conversion of 'i' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
55 | add_and({i, n+i});
| ^
vision.cpp:55:12: warning: narrowing conversion of 'i' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
vision.cpp:55:16: warning: narrowing conversion of '(((ll)n) + i)' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
55 | add_and({i, n+i});
| ~^~
vision.cpp:55:16: warning: narrowing conversion of '(((ll)n) + i)' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
# | 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... |