이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef vector<int> vi;
const int len = 205;
int n, m, k;
bool exist(int i, int j){
return (0 <= i && i < n && 0 <= j && j < m);
}
int match(int i, int j){
return i*m + j;
}
vi diag_sum(int con){
vi res;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
if (i+j == con) res.pb(match(i, j));
return res;
}
vi diag_dif(int con){
vi res;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
if (i-j == con) res.pb(match(i, j));
return res;
}
void construct_network(int H, int W, int K) {
n = H, m = W, k = K;
vi temp, sum, dif;
/// precompute everything
// compute sum[], dif[]
for (int con = 0; con <= n+m-2; con++)
sum.pb(add_xor(diag_sum(con)));
for (int con = -m+1; con <= n-1; con++)
dif.pb(add_xor(diag_dif(con)));
// compute equal_sum, equal_dif
temp.clear();
for (int i = 0; i+k < sum.size(); i++)
temp.pb(add_and({sum[i], sum[i+k]}));
int equal_sum = add_or(temp);
temp.clear();
for (int i = 0; i+k < dif.size(); i++)
temp.pb(add_and({dif[i], dif[i+k]}));
int equal_dif = add_or(temp);
// compute less_sum, less_dif
temp.clear();
temp.pb(add_not(add_or(sum)));
for (int i = 0; i < sum.size(); i++){
vi temp2;
for (int j = i+1; j < min(i+k, (int)sum.size()); j++)
temp2.pb(sum[j]);
if (!temp2.empty())
temp.pb(add_and({sum[i], add_or(temp2)}));
}
int less_sum = add_or(temp);
temp.clear();
temp.pb(add_not(add_or(dif)));
for (int i = 0; i < dif.size(); i++){
vi temp2;
for (int j = i+1; j < min(i+k, (int)dif.size()); j++)
temp2.pb(dif[j]);
if (!temp2.empty())
temp.pb(add_and({sum[i], add_or(temp2)}));
}
int less_dif = add_or(temp);
/// find ans:)
add_or({add_and({less_sum, equal_dif}), add_and({less_dif, equal_sum})});
}
컴파일 시 표준 에러 (stderr) 메시지
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:49:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
49 | for (int i = 0; i+k < sum.size(); i++)
| ~~~~^~~~~~~~~~~~
vision.cpp:54:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
54 | for (int i = 0; i+k < dif.size(); i++)
| ~~~~^~~~~~~~~~~~
vision.cpp:61:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
61 | for (int i = 0; i < sum.size(); i++){
| ~~^~~~~~~~~~~~
vision.cpp:72:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
72 | for (int i = 0; i < dif.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... |