이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 998244353ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
using namespace std;
#ifndef death
#include "vision.h"
#endif
#ifdef death
int add_not(int x)
{
cout << "add_not " << x << endl;
}
int add_and(vector<int> a)
{
cout << "add_and ";
for (int i = 0; i < a.size(); i++)
cout << a[i] << " ";
cout << endl;
}
int add_or(vector<int> a)
{
cout << "add_or ";
for (int i = 0; i < a.size(); i++)
cout << a[i] << " ";
cout << endl;
}
int add_xor(vector<int> a)
{
cout << "add_xor ";
for (int i = 0; i < a.size(); i++)
cout << a[i] << " ";
cout << endl;
}
#endif
int n, m, k;
int ind(int y, int x)
{
return y * m + x;
}
int id;
vector<vector<int>> p;
void construct_network(int H, int W, int K)
{
srand(9896);
n = H;
m = W;
k = K;
id = n * m;
vector<int> last;
vector<pair<int, int>> pos;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
pos.PB(MP(i, j));
//random_shuffle(all(pos));
for (int c = 0; c < pos.size() && id - n * m + 1 <= 10000 - 2; c++)
{
int i = pos[c].first;
int j = pos[c].second;
vector<int> x;
for (int I = 0; I < n; I++)
for (int J = 0; J < m; J++)
if (abs(i - I) + abs(j - J) == k && ind(i, j) > ind(I, J))
x.PB(ind(I, J));
if (x.empty())
continue;
add_xor(x);
id++;
x.clear();
x.PB(id - 1);
x.PB(ind(i, j));
add_and(x);
id++;
last.PB(id - 1);
}
add_or(last);
}
#ifdef death
int main()
{
int N, M, K;
cin >> N >> M >> K;
construct_network(N, M, K);
return 0;
}
#endif
/*
*/
컴파일 시 표준 에러 (stderr) 메시지
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:88:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int c = 0; c < pos.size() && id - n * m + 1 <= 10000 - 2; 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... |