zawatins-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub zawa-tin/zawatins-library

:heavy_check_mark: test/ABC278-E.test.cpp

Depends on

Code

#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/1/ITP1_1_A"

#include "../src/dataStructure/accum2d.hpp"

#include <iostream>
#include <vector>

int main() {
	// int H, W, N, h, w; std::cin >> H >> W >> N >> h >> w;
	// std::vector A(N, std::vector(H, std::vector(W, 0)));
	// for (int i = 0 ; i < H ; i++) {
	// 	for (int j = 0 ; j < W ; j++) {
	// 		int a; std::cin >> a;
	// 		A[a - 1][i][j]++;
	// 	}
	// }
	// std::vector<zawa::accum2d<int>> S(N);
	// for (int i = 0 ; i < N ; i++) {
	// 	S[i] = zawa::accum2d(A[i]);
	// }
	// for (int i = 0 ; i + h <= H ; i++) {
	// 	for (int j = 0 ; j + w <= W ; j++) {
	// 		int ans = 0;
	// 		for (int k = 0 ; k < N ; k++) {
	// 			ans += (S[k].sum(0, 0, H, W) - S[k].sum(i, j, i + h, j + w) > 0);
	// 		}
	// 		std::cout << ans << (j + w == W ? '\n' : ' ');
	// 	}
	// }
	std::cout << "Hello World" << std::endl;
}

/*
 * AtCoder Beginner Contest 278 - E Grid Filling
 * https://atcoder.jp/contests/abc278/submissions/38162869
 */
#line 1 "test/ABC278-E.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/1/ITP1_1_A"

#line 2 "src/dataStructure/accum2d.hpp"

#include <vector>
#include <utility>

namespace zawa {

template <class T>
struct accum2d : std::vector<std::vector<T>> {
	accum2d() {
		(*this).push_back({ T() });
	}
	accum2d(const std::vector<std::vector<T>>& A) : std::vector<std::vector<T>>(A.size() + 1, std::vector<T>(A[0].size() + 1, T())) {
		for (std::size_t i = 0 ; i < A.size() ; i++) {
			for (std::size_t j = 0 ; j < A[i].size() ; j++) {
				(*this)[i + 1][j + 1] = (*this)[i][j + 1] + (*this)[i + 1][j] - (*this)[i][j] + A[i][j];
			}
		}
	}
	T sum(std::size_t y1, std::size_t x1, std::size_t y2, std::size_t x2) {
		return (*this)[y2][x2] - (*this)[y1][x2] - (*this)[y2][x1] + (*this)[y1][x1];
	}
	T sum(std::pair<std::size_t, std::size_t> p1, std::pair<std::size_t, std::size_t> p2) {
		return sum(p1.first, p1.second, p2.first, p2.second);
	}
};

} // namespace zawa
#line 4 "test/ABC278-E.test.cpp"

#include <iostream>
#line 7 "test/ABC278-E.test.cpp"

int main() {
	// int H, W, N, h, w; std::cin >> H >> W >> N >> h >> w;
	// std::vector A(N, std::vector(H, std::vector(W, 0)));
	// for (int i = 0 ; i < H ; i++) {
	// 	for (int j = 0 ; j < W ; j++) {
	// 		int a; std::cin >> a;
	// 		A[a - 1][i][j]++;
	// 	}
	// }
	// std::vector<zawa::accum2d<int>> S(N);
	// for (int i = 0 ; i < N ; i++) {
	// 	S[i] = zawa::accum2d(A[i]);
	// }
	// for (int i = 0 ; i + h <= H ; i++) {
	// 	for (int j = 0 ; j + w <= W ; j++) {
	// 		int ans = 0;
	// 		for (int k = 0 ; k < N ; k++) {
	// 			ans += (S[k].sum(0, 0, H, W) - S[k].sum(i, j, i + h, j + w) > 0);
	// 		}
	// 		std::cout << ans << (j + w == W ? '\n' : ' ');
	// 	}
	// }
	std::cout << "Hello World" << std::endl;
}

/*
 * AtCoder Beginner Contest 278 - E Grid Filling
 * https://atcoder.jp/contests/abc278/submissions/38162869
 */
Back to top page