이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
void read(T &x)
{
x = 0;
register int c;
while ((c = getchar()) && (c > '9' || c < '0'))
;
for (; c >= '0' && c <= '9'; c = getchar())
x = x * 10 + c - '0';
}
constexpr bool typetest = 0;
constexpr int N = 2e2 + 5;
vector<int> inc[N * 2], decs[N * 2], inchave, decshave;
int pinc[N], pdecs[N];
/// f(x) = 1 if distance between two black point isn't less than x, 0 otherwise
int f(int H, int W, int x)
{
vector<int> tmp;
for (int i = x; i <= H + W - 2; ++i)
{
tmp.emplace_back(add_and({inchave[i], pinc[i - x]}));
tmp.emplace_back(add_and({decshave[i], pdecs[i - x]}));
}
return add_or(tmp);
}
void construct_network(int H, int W, int K)
{
#define pos(x, y) (W * x + y)
for (int i = 0; i < H; ++i)
for (int j = 0; j < W; ++j)
{
inc[i + j].emplace_back(pos(i, j));
decs[i + (W - 1 - j)].emplace_back(pos(i, j));
}
for (int i = 0; i <= H + W - 2; ++i)
{
inchave.emplace_back(add_or(inc[i]));
decshave.emplace_back(add_or(decs[i]));
if (i)
{
pinc[i] = add_or({inchave[i], pinc[i - 1]});
pdecs[i] = add_or({decshave[i], pdecs[i - 1]});
}
else
{
pinc[i] = inchave[i];
pdecs[i] = decshave[i];
}
}
// f(k) == 1 and f(k + 1) == 0 => k is answer
if (K == H + W - 2)
add_and({f(H, W, K)});
else
add_and({f(H, W, K), add_not(f(H, W, K + 1))});
}
/*
void Read()
{
}
void Solve()
{
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
if (fopen("palesta.INP", "r"))
{
freopen("paletsa.inp", "r", stdin);
freopen("palesta.out", "w", stdout);
}
int t(1);
if (typetest)
cin >> t;
for (int _ = 1; _ <= t; ++_)
{
// cout << "Case #" << _ << ": ";
Read();
Solve();
}
// cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}
/*
11
-1 4
-4 2
-5 0
0 0
-3 -2
1 -2
5 -2
2 -3
-1 -4
1 -4
3 -4
*/
컴파일 시 표준 에러 (stderr) 메시지
vision.cpp:104:1: warning: "/*" within comment [-Wcomment]
104 | /*
|
vision.cpp: In function 'void read(T&)':
vision.cpp:13:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
13 | register int c;
| ^
# | 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... |