#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
int h, w;
int order (int x, int y) { return x*w+y; }
// void print (vector<int> v) { for (auto x : v) cerr << x << ' '; cerr << endl;}
void construct_network(int H, int W, int K) {
h=H; w=W;
vector<int> firstor, secondor, _and;
for (int i = 0; i < H+W-1; i++) {
vector<int> v1, v2;
for (int j = 0; j < min(i+1, W); j++) {
if (!(i-j >= H or j >= W)) v1.push_back(order(i-j, j));
if (!(i-j >= H or W-1-j >= W)) v2.push_back(order(i-j, W-1-j));
}
// cerr << "print1 "; print(v1);
// cerr << "print2 "; print(v2);
firstor.push_back(add_or(v1));
secondor.push_back(add_or(v2));
}
for (int i = 0; i < firstor.size(); i++) {
if (i+K >= firstor.size()) break;
_and.push_back(add_and({firstor[i], firstor[i+K]}));
_and.push_back(add_and({secondor[i], secondor[i+K]}));
}
int ans = add_or(_and);
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:22:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < firstor.size(); i++) {
~~^~~~~~~~~~~~~~~~
vision.cpp:23:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (i+K >= firstor.size()) break;
~~~~^~~~~~~~~~~~~~~~~
vision.cpp:27:6: warning: unused variable 'ans' [-Wunused-variable]
int ans = add_or(_and);
^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
368 KB |
Output is correct |
7 |
Incorrect |
5 ms |
376 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
368 KB |
Output is correct |
7 |
Incorrect |
5 ms |
376 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
368 KB |
Output is correct |
7 |
Incorrect |
5 ms |
376 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
368 KB |
Output is correct |
7 |
Incorrect |
5 ms |
376 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
5 ms |
376 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
5 ms |
376 KB |
Output is correct |
18 |
Correct |
5 ms |
376 KB |
Output is correct |
19 |
Correct |
5 ms |
376 KB |
Output is correct |
20 |
Correct |
5 ms |
376 KB |
Output is correct |
21 |
Correct |
5 ms |
256 KB |
Output is correct |
22 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
376 KB |
Output is correct |
4 |
Correct |
6 ms |
376 KB |
Output is correct |
5 |
Correct |
6 ms |
376 KB |
Output is correct |
6 |
Correct |
6 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
7 ms |
504 KB |
Output is correct |
9 |
Correct |
7 ms |
504 KB |
Output is correct |
10 |
Correct |
6 ms |
504 KB |
Output is correct |
11 |
Correct |
7 ms |
504 KB |
Output is correct |
12 |
Correct |
6 ms |
376 KB |
Output is correct |
13 |
Correct |
6 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
6 ms |
376 KB |
Output is correct |
18 |
Correct |
5 ms |
376 KB |
Output is correct |
19 |
Correct |
5 ms |
376 KB |
Output is correct |
20 |
Correct |
10 ms |
760 KB |
Output is correct |
21 |
Incorrect |
10 ms |
764 KB |
on inputs (0, 0), (199, 99), expected 0, but computed 1 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
1272 KB |
on inputs (126, 120), (176, 169), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |
6 |
Correct |
5 ms |
368 KB |
Output is correct |
7 |
Incorrect |
5 ms |
376 KB |
on inputs (0, 2), (1, 0), expected 0, but computed 1 |
8 |
Halted |
0 ms |
0 KB |
- |