#include<bits/stdc++.h>
#include "vision.h"
#define fi first
#define se second
#define ll long long
using namespace std ;
vector<int> abu ;
//int add_xor(vector<int> v)
//{
// int num = 0 ;
// cout << "XOR ? " ;
// for(int i : v)
// {
// num ^= abu[i] ;
// cout << i << ' ' ;
// }
// cout << '\n' ;
// abu.push_back(num) ;
// return abu.size() - 1 ;
//}
//int add_or(vector<int> v)
//{
// int num = 0 ;
// cout << "OR ? " ;
// for(int i : v)
// {
// num |= abu[i] ;
// cout << i << ' ' ;
// }
// cout << '\n' ;
// abu.push_back(num) ;
// return abu.size() - 1 ;
//}
//int add_and(vector<int> v)
//{
// int num = abu[v[0]] ;
// cout << "AND ? " ;
// for(int i : v)
// {
// num &= abu[i] ;
// cout << i << ' ' ;
// }
// abu.push_back(num) ;
// cout << '\n' ;
// return abu.size() - 1 ;
//}
void construct_network(int n, int m, int k)
{
vector<int> arr_l, arr_l_k1, arr_l_k, arr_r, arr_r_k1, arr_r_k ;
for(int i = n - 1 ; i >= 0 ; i--)
{
int x = i, y = 0 ;
vector<int> now ;
while(x < n && y < m)
{
now.push_back(x * m + y) ;
x++ ;
y++ ;
}
arr_l.push_back(add_or(now)) ;
}
for(int i = 1 ; i < m ; i++)
{
int x = 0, y = i ;
vector<int> now ;
while(x < n && y < m)
{
now.push_back(x * m + y) ;
x++ ;
y++ ;
}
arr_l.push_back(add_or(now)) ;
}
for(int i = k - 1 ; i < arr_l.size() ; i++)
{
vector<int> now ;
for(int j = i - k + 1 ; j <= i ; j++)
now.push_back(arr_l[j]) ;
arr_l_k.push_back(add_xor({add_xor(now), add_or(now)})) ;
}
for(int i = k ; i < arr_l.size() ; i++)
{
vector<int> now ;
for(int j = i - k ; j <= i ; j++)
now.push_back(arr_l[j]) ;
arr_l_k1.push_back(add_xor({add_xor(now), add_or(now)})) ;
}
for(int i = 0 ; i < m ; i++)
{
int x = 0, y = i ;
vector<int> now ;
while(x < n && y >= 0)
{
now.push_back(x * m + y) ;
x++ ;
y-- ;
}
arr_r.push_back(add_or(now)) ;
}
for(int i = 1 ; i < n ; i++)
{
int x = i, y = m - 1 ;
vector<int> now ;
while(x < n && y >= 0)
{
now.push_back(x * m + y) ;
x++ ;
y-- ;
}
arr_r.push_back(add_or(now)) ;
}
for(int i = k - 1 ; i < arr_r.size() ; i++)
{
vector<int> now ;
for(int j = i - k + 1 ; j <= i ; j++)
now.push_back(arr_r[j]) ;
arr_r_k.push_back(add_xor({add_xor(now), add_or(now)})) ;
}
for(int i = k ; i < arr_r.size() ; i++)
{
vector<int> now ;
for(int j = i - k ; j <= i ; j++)
now.push_back(arr_r[j]) ;
arr_r_k1.push_back(add_xor({add_xor(now), add_or(now)})) ;
}
int num1 = add_and({add_or(arr_r_k1), add_or(arr_l_k1)}), num2 = add_and({add_or(arr_r_k), add_or(arr_l_k)}) ;
add_xor({num1, num2}) ;
// cout << "Left\n" ;
// for(int i : arr_l)
// cout << abu[i] << ' ' ;
// cout << '\n' ;
// cout << "Left dist k\n" ;
// for(int i : arr_l_k)
// cout << abu[i] << ' ' ;
// cout << '\n' ;
// cout << "Left dist k + 1\n" ;
// for(int i : arr_l_k1)
// cout << abu[i] << ' ' ;
// cout << '\n' ;
// cout << "Right\n" ;
// for(int i : arr_r)
// cout << abu[i] << ' ' ;
// cout << '\n' ;
// cout << "Right dist k\n" ;
// for(int i : arr_r_k)
// cout << abu[i] << ' ' ;
// cout << '\n' ;
// cout << "Right dist k + 1\n" ;
// for(int i : arr_r_k1)
// cout << abu[i] << ' ' ;
// cout << '\n' ;
}
//signed main()
//{
// int t ;
// cin >> t ;
// while(t--)
// {
// int n, m, k ;
// cin >> n >> m >> k ;
// for(int i = 0 ; i < n ; i++)
// for(int j = 0 ; j < m ; j++)
// {
// int a ;
// cin >> a ;
// abu.push_back(a) ;
// }
// construct_network(n, m, k) ;
// for(int i : abu)
// cout << i << ' ' ;
// cout << '\n' ;
// abu.clear() ;
// }
// return 0 ;
//}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:74:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
74 | for(int i = k - 1 ; i < arr_l.size() ; i++)
| ~~^~~~~~~~~~~~~~
vision.cpp:81:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
81 | for(int i = k ; i < arr_l.size() ; i++)
| ~~^~~~~~~~~~~~~~
vision.cpp:112:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
112 | for(int i = k - 1 ; i < arr_r.size() ; i++)
| ~~^~~~~~~~~~~~~~
vision.cpp:119:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
119 | for(int i = k ; i < arr_r.size() ; i++)
| ~~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
7 ms |
980 KB |
Output is correct |
3 |
Correct |
7 ms |
980 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
468 KB |
Output is correct |
6 |
Correct |
7 ms |
980 KB |
Output is correct |
7 |
Correct |
6 ms |
852 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
6 ms |
980 KB |
Output is correct |
11 |
Correct |
7 ms |
980 KB |
Output is correct |
12 |
Correct |
7 ms |
980 KB |
Output is correct |
13 |
Correct |
5 ms |
852 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
468 KB |
Output is correct |
16 |
Correct |
7 ms |
980 KB |
Output is correct |
17 |
Correct |
7 ms |
1044 KB |
Output is correct |
18 |
Correct |
7 ms |
1020 KB |
Output is correct |
19 |
Correct |
5 ms |
724 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
1488 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
2 ms |
596 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
6 ms |
976 KB |
Output is correct |
8 |
Correct |
7 ms |
912 KB |
Output is correct |
9 |
Correct |
9 ms |
1488 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
296 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |