https://atcoder.jp/contests/ahc001
N個の長方形を 10000x10000 グリッド上に配置せよ
- 各長方形には必ず含まないといけないセルが1つずつ指定されている
- 重なっちゃいけない
- 指定セルに重複はない
#include <string> | |
#define NDEBUG | |
#include <cassert> | |
#include <chrono> | |
#include <cmath> | |
#include <ctime> | |
#include <iomanip> | |
#include <iostream> | |
#include <random> |
https://atcoder.jp/contests/ahc001
N個の長方形を 10000x10000 グリッド上に配置せよ
import numpy as np | |
import matplotlib.pyplot as plt | |
import argparse | |
def read_output(file_name): | |
with open(file_name) as f: | |
vars, terms = map(int, f.readline().split()) | |
res = [] | |
for _ in range(terms): |
from __future__ import print_function | |
from ortools.linear_solver import pywraplp | |
from functools import reduce | |
import sys | |
import time | |
class PointsOnGrid: | |
def findSolution(self, H, W, h, w, Kmin, Kmax, grid): | |
solver = pywraplp.Solver('SolveIntegerProblem', | |
pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING) |
while now < timeLimit { | |
blocks[] = splitBoard( rand( maxBlockSize ) ); // 適当な大きさに分割 | |
for block in blocks{ // それぞれのブロックに対して焼きなます | |
for i in 0...SAIteration { // SAIteration 回 見ます | |
cell = nextCell(block) // ナイト置く / 取る位置 | |
flip(cell) // 実際にはスコア計算するだけで flip しない | |
if accept(i, nextState) { // 焼き鈍し A。 invalid な状態も許容。 i が大きいときはペナルティを大きく | |
state = nextState // 状態を更新。 これは invalid かも知れない |
#include <iostream> | |
using namespace std; | |
int main(){ | |
cout << "test" << endl; | |
return 0; | |
} |