CF1715F.Crop Squares

省选/NOI-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

This is an interactive problem.

Farmer Stanley grows corn on a rectangular field of size $ n \times m $ meters with corners in points (0,0)(0, 0), (0,m)(0, m), (n,0)(n, 0), (n,m)(n, m). This year the harvest was plentiful and corn covered the whole field.

The night before harvest aliens arrived and poisoned the corn in a single 1×11 \times 1 square with sides parallel to field borders. The corn inside the square must not be eaten, but you cannot distinguish it from ordinary corn by sight. Stanley can only collect a sample of corn from an arbitrary polygon and bring it to the laboratory, where it will be analyzed and Stanley will be told the amount of corn in the sample that was poisoned. Since the harvest will soon deteriorate, such a study can be carried out no more than 55 times.

More formally, it is allowed to make no more than 55 queries, each of them calculates the area of intersection of a chosen polygon with a square of poisoned corn. It is necessary to find out the coordinates of the lower-left corner of the drawn square (the vertex of the square with the smallest xx and yy coordinates).

这是一个交互式问题。

农夫斯坦利在一块大小为 $ n \times m $ 米的矩形田地上种植玉米,田地四个角的坐标分别为 (0,0)(0, 0)、(0,m)(0, m)、(n,0)(n, 0) 和 (n,m)(n, m)。今年收成颇丰,整块田地都被玉米覆盖。

收获前夜,外星人抵达并毒化了田地中唯一一个边与田地边界平行的 1×11 \times 1 正方形区域内的玉米。该正方形内部的玉米不可食用,但其外观与普通玉米完全相同,无法通过肉眼分辨。斯坦利只能从任意多边形区域内采集一份玉米样本送至实验室;实验室将分析该样本,并告知斯坦利其中被毒化的玉米所占的面积(即该多边形与毒化正方形的交集面积)。由于玉米很快会变质,此类检测最多只能进行 55 次。

更形式化地说:你最多可进行 55 次查询,每次查询指定一个任意多边形,系统将返回该多边形与毒化正方形的交集面积。你需要据此确定该毒化正方形左下角顶点的坐标(即该正方形中 xx 坐标和 yy 坐标均最小的那个顶点)。

输入格式

First line contains two integers nn and mm (1≤n,m≤1001 \le n, m \le 100) — field sizes.

第一行包含两个整数 nn 和 mm(1≤n,m≤1001 \le n, m \le 100)—— 表示场地的尺寸。

输入输出样例

  • 输入#1

    3 3
    
    
    
    
    
    0.5
    
    
    
    
    
    0.5

    输出#1

    ? 4
    0 0
    2 0
    2 3
    0 3
    
    ? 4
    0 0
    0 1
    3 1
    3 0
    
    ! 1.5 0.5

说明/提示

In the first test from the statement, the aliens poisoned a square of corn with vertices at points with coordinates (1.5,0.5)(1.5, 0.5), (1.5,1.5)(1.5, 1.5), (2.5,1.5)(2.5, 1.5), (2.5,0.5)(2.5, 0.5). In the picture, it is red, the polygon selected in the query is blue, and their intersection is green.

Picture for the first query:

Picture for the second query:

在题面给出的第一个测试用例中,外星人毒害了一块玉米地,其为一个正方形,四个顶点的坐标分别为 (1.5,0.5)(1.5, 0.5)、(1.5,1.5)(1.5, 1.5)、(2.5,1.5)(2.5, 1.5) 和 (2.5,0.5)(2.5, 0.5)。图中,被毒害的区域为红色,查询中选定的多边形为蓝色,二者交集部分为绿色。

第一个查询对应的图片:

第二个查询对应的图片:

输入解题思路,AI测评打分。不知道怎么写?

首页