이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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_two, arr_l_k1, arr_l_k, arr_r, arr_r_two, 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 = 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_two.push_back(add_and({add_xor(arr_l), 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_two.push_back(add_and({add_xor(arr_l), add_or(now)})) ;
}
for(int i = k - 1 ; i < arr_l.size() ; i++)
{
vector<int> now, now1 ;
for(int j = i - k + 1 ; j <= i ; j++)
now.push_back(arr_l[j]), now1.push_back(arr_l_two[j]) ;
int num = add_xor({add_xor(now), add_or(now)}) ;
now1.push_back(num) ;
arr_l_k.push_back(add_or(now1)) ;
}
for(int i = k ; i < arr_l.size() ; i++)
{
vector<int> now, now1 ;
for(int j = i - k ; j <= i ; j++)
now.push_back(arr_l[j]), now1.push_back(arr_l_two[j]) ;
int num = add_xor({add_xor(now), add_or(now)}) ;
now1.push_back(num) ;
arr_l_k1.push_back(add_or(now1)) ;
}
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 = 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_two.push_back({add_and({add_xor(arr_r), 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_two.push_back(add_and({add_xor(arr_r), add_or(now)})) ;
}
for(int i = k - 1 ; i < arr_r.size() ; i++)
{
vector<int> now, now1 ;
for(int j = i - k + 1 ; j <= i ; j++)
now.push_back(arr_r[j]), now1.push_back(arr_r_two[j]) ;
int num = add_xor({add_xor(now), add_or(now)}) ;
now1.push_back(num) ;
arr_r_k.push_back(add_or(now1)) ;
}
for(int i = k ; i < arr_r.size() ; i++)
{
vector<int> now, now1 ;
for(int j = i - k ; j <= i ; j++)
now.push_back(arr_r[j]), now1.push_back(arr_r_two[j]) ;
int num = add_xor({add_xor(now), add_or(now)}) ;
now1.push_back(num) ;
arr_r_k1.push_back(add_or(now1)) ;
}
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 ;
//}
//1
//2 2 2
//1 0
//0 1
컴파일 시 표준 에러 (stderr) 메시지
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:98:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
98 | for(int i = k - 1 ; i < arr_l.size() ; i++)
| ~~^~~~~~~~~~~~~~
vision.cpp:107:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
107 | for(int i = k ; i < arr_l.size() ; i++)
| ~~^~~~~~~~~~~~~~
vision.cpp:164:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
164 | for(int i = k - 1 ; i < arr_r.size() ; i++)
| ~~^~~~~~~~~~~~~~
vision.cpp:173:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
173 | for(int i = k ; i < arr_r.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... |