제출 #1048707

#제출 시각아이디문제언어결과실행 시간메모리
1048707MercubytheFirstVision Program (IOI19_vision)C++17
8 / 100
1 ms432 KiB
#include "bits/stdc++.h"
#include "vision.h"
#define pb push_back
#define endl '\n'
#define fi first
#define se second
#define CDIV(a,b) (((a)+(b)-(1))/(b))
using ll = long long;
using ld = long double;
const ll inf = 1e17 + 37;
const ll mod = 1e9 + 7;
const ll N = 3000 + 1;
const ld eps = 1e-9;
const ld PI = acos((ld)-1);

template<typename T, size_t N>
std::ostream& operator<<(std::ostream& os, const std::array<T, N>& a);
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& v);
template<typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p);
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& s);
template<typename T, typename cmp>
std::ostream& operator<<(std::ostream& os, const std::set<T, cmp>& s);
using namespace std;



void construct_network(int H, int W, int K) {
	std::vector<int> Ns;

	auto dist = [&] (int p1, int p2) -> int
	{
		int x = p1 / W, y = p1 % W;
		int xx = p2 / W, yy = p2 % W;
		// cout << x << ' ' << y << " : " << xx << ' ' << yy << ' ' << abs(x - xx) + abs(y - yy) << endl;
		return abs(x - xx) + abs(y - yy);
	};

	int last = H * W;
	vector<int> or_query;
	for(int i = 0; i < H; ++i) {
		for(int j = 0; j < W; ++j) {
			if(i + j == K) {
				or_query.push_back(W*i + j);
			}
		}
	}
	// assert(!Ns.empty());
	add_or(or_query);
}
















template<typename T, size_t N>
std::ostream& operator<<(std::ostream& os, const std::array<T, N>& a) {
  os << "[";
  for(size_t i = 0; i + 1 < N; ++i) {
    os << a[i] << ", ";
  }
  if(N > 0)
    os << a[N - 1];
  os << "]";
  return os;
}
 
template<typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) {
  os << "(" << p.first << ", " << p.second << ") ";
  return os;
}
 
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  os << '[';
  for(auto x : v)
    os << x << ", ";
  os << "] ";
  return os;
}
 
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& s) {
  os << "{";
  for(auto x : s)
    os << x << ", ";
  os << "} ";
  return os;
}
//
template<typename T, typename cmp>
std::ostream& operator<<(std::ostream& os, const std::set<T, cmp>& s) {
  os << "{";
  for(auto x : s)
    os << x << ", ";
  os << "} ";
  return os;
}

컴파일 시 표준 에러 (stderr) 메시지

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:33:7: warning: variable 'dist' set but not used [-Wunused-but-set-variable]
   33 |  auto dist = [&] (int p1, int p2) -> int
      |       ^~~~
vision.cpp:41:6: warning: unused variable 'last' [-Wunused-variable]
   41 |  int last = H * W;
      |      ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...