亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

codeforces 763B. Timofey and rectangles [思維]【智商】

2019-11-11 06:01:20
字體:
來源:轉載
供稿:網友

題目連接:http://codeforces.com/PRoblemset/problem/763/B

——————————————————————————————-. time limit per test2 seconds memory limit per test256 megabytes

inputstandard input outputstandard output

One of Timofey’s birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other.

Help Timofey to color his rectangles in 4 different colors in such a way that every two rectangles touching each other by side would have different color, or determine that it is impossible.

Two rectangles intersect if their intersection has positive area. Two rectangles touch by sides if there is a pair of sides such that their intersection has non-zero length

The picture corresponds to the first example Input The first line contains single integer n (1?≤?n?≤?5·105) — the number of rectangles.

n lines follow. The i-th of these lines contains four integers x1, y1, x2 and y2 (?-?109?≤?x1?<?x2?≤?109, ?-?109?≤?y1?<?y2?≤?109), that means that points (x1,?y1) and (x2,?y2) are the coordinates of two opposite corners of the i-th rectangle.

It is guaranteed, that all sides of the rectangles have odd lengths and rectangles don’t intersect each other.

Output Print “NO” in the only line if it is impossible to color the rectangles in 4 different colors in such a way that every two rectangles touching each other by side would have different color.

Otherwise, print “YES” in the first line. Then print n lines, in the i-th of them print single integer ci (1?≤?ci?≤?4) — the color of i-th rectangle.

Example

input

8 0 0 5 3 2 -1 5 0 -3 -4 2 -1 -1 -1 2 0 -3 0 0 5 5 2 10 3 7 -3 10 2 4 -2 7 -1

output

YES 1 2 2 3 2 2 4 1

——————————————————————————————-. 題目大意: 就是在一個二維平面上有n個矩形,現在讓你給這n個矩形4種涂色之一,使得相鄰的矩形顏色不同. (矩形的兩條邊都是整數) 解題思路:

我這種智障是做不出來的,本來并不想寫題解,但是無意中看了Tutorial中的discuss發現一個特別容易理解的.

We may assume that our rectangles are drawn on an infinite sheet of squared paper. Divide it into squares 2 × 2 and mark the cells in each square by 1, 2, 3, 4 clockwise starting from the upper left corner. Since both sides of each rectangle are of odd length, its corner cells are marked by the same number. Let us number four different colors by 1, 2, 3, 4 and paint each rectangle with the color whose number marks the corner cells. It is readily seen that the numbers in the corners of any two adjacent rectangles are distinct. 我們可能會認為我們的矩形被畫在無限平方的紙。將紙分成一個個2×2方塊,然后從左上角順時針方向開始標上1,2,3,4(代表顏色)。由于每個矩形的兩邊都是奇數長度,所以它的所有格子標記為相同的數。讓我們用1,2,3,4個不同的顏色編號,并繪制每個矩形的顏色的數字標記的格子。很容易看出,任何兩個相鄰矩形的角的數是不同的。 (基本是機翻……可以自己畫一畫就容易理解了,Orz)

附本題代碼 ——————————————————————————————-.

int main(){ int x1,x2,y1,y2; int n ; s1(n);puts("YES"); Rep(i,1,n){ s1(x1),s1(x2),s1(y1),s1(y2); x1=(x1%2+2)%2; x2=(x2%2+2)%2; printf("%d/n",x1+x2*2+1); } return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
久久久久久久久久久成人| 日韩av日韩在线观看| 国产专区精品视频| 亚洲第一网站免费视频| 97精品国产97久久久久久春色| 97精品久久久| 欧美日韩亚洲视频一区| 97色在线视频| 亚洲理论片在线观看| 久久久精品999| 亚洲免费伊人电影在线观看av| 成人av资源在线播放| 97香蕉久久超级碰碰高清版| 国产有码一区二区| 久久久99久久精品女同性| 青青草精品毛片| 色视频www在线播放国产成人| 欧美高清电影在线看| 国产精品27p| 日韩风俗一区 二区| 亚洲精品中文字幕av| 亚洲精品不卡在线| 久久精品亚洲一区| 国产精品青草久久久久福利99| 午夜精品视频网站| 国产精品日韩专区| 69影院欧美专区视频| 668精品在线视频| 亚洲国产一区二区三区在线观看| 亚洲激情在线观看| 亚洲成人三级在线| 欧美精品一区二区免费| 亚洲第一页在线| 欧美成人h版在线观看| 亚洲综合一区二区不卡| 久久久成人精品| 久久亚洲影音av资源网| 日韩亚洲欧美中文在线| 国产精品丝袜一区二区三区| 欧美日韩另类在线| 色噜噜久久综合伊人一本| 国产精品专区h在线观看| 精品欧美国产一区二区三区| 成人国产在线激情| 欧美高清在线观看| 日韩在线视频二区| 国产在线精品自拍| 欧美视频二区36p| 亚洲视频一区二区| 国产亚洲精品一区二区| 美日韩精品免费观看视频| 日韩精品在线免费观看视频| 国产精品永久免费视频| 亚洲激情免费观看| 久久久久99精品久久久久| 亚洲理论在线a中文字幕| 久久激情视频免费观看| 日韩美女激情视频| 免费91在线视频| 欧美黑人一级爽快片淫片高清| 96国产粉嫩美女| 国产精品白丝jk喷水视频一区| 日韩欧亚中文在线| 欧美日韩一区二区三区| 这里只有精品久久| 亚洲一区二区三区四区视频| 成人写真视频福利网| 精品国产网站地址| 午夜精品一区二区三区在线| 日韩av在线直播| 国产精品视频永久免费播放| 91精品中国老女人| 中文字幕精品一区二区精品| 亚洲人精品午夜在线观看| 国产日韩欧美在线看| 黑人巨大精品欧美一区免费视频| 亚洲午夜激情免费视频| 欧美一级在线亚洲天堂| 国产精品人成电影在线观看| 亚洲欧美一区二区激情| 欧美一区三区三区高中清蜜桃| 欧美韩国理论所午夜片917电影| 欧美日韩一区二区精品| 国产午夜一区二区| 亚洲黄色在线看| 97久久超碰福利国产精品…| 国产成人一区二区三区小说| 亚洲人成免费电影| 一本大道亚洲视频| 久久男人资源视频| 国产精品劲爆视频| 91精品久久久久| 国产成人精品久久| 亚洲一区美女视频在线观看免费| 91午夜理伦私人影院| 欧美国产一区二区三区| 精品国产一区二区三区久久久狼| 一个人看的www欧美| 国产精品久久久久久久9999| 久久久久免费精品国产| 欧洲一区二区视频| 日韩**中文字幕毛片| 91免费国产视频| 国产在线久久久| 日韩中文在线不卡| 91高清视频在线免费观看| 精品欧美激情精品一区| 国产人妖伪娘一区91| 久久精品青青大伊人av| 亚洲成色www8888| 久久亚洲综合国产精品99麻豆精品福利| 91av在线视频观看| 国产成人精品优优av| 国产在线视频2019最新视频| 欧美大尺度激情区在线播放| 亚洲字幕一区二区| 成人av番号网| 亚洲国产欧美一区二区丝袜黑人| 日本高清+成人网在线观看| 97国产suv精品一区二区62| 中文字幕无线精品亚洲乱码一区| 欧美精品一区二区三区国产精品| 国产91在线播放| 日韩av影视综合网| 最新国产精品拍自在线播放| 亚洲美女av网站| 欧美日韩成人在线播放| 欧美专区中文字幕| 亚洲色图av在线| 国产欧美最新羞羞视频在线观看| 国产精品扒开腿做爽爽爽男男| 911国产网站尤物在线观看| 91精品免费视频| 精品视频偷偷看在线观看| 亚洲欧美日韩天堂| 91香蕉嫩草神马影院在线观看| 国产精品视频在线观看| 俺也去精品视频在线观看| 久久精品青青大伊人av| 国产精品一久久香蕉国产线看观看| 亚洲网站在线观看| 日韩精品一区二区视频| 91在线精品播放| 亚洲午夜激情免费视频| 日韩在线观看av| 日韩精品视频免费在线观看| 国产亚洲欧洲黄色| 超碰97人人做人人爱少妇| 久久影视电视剧免费网站清宫辞电视| 91美女片黄在线观看游戏| 欧美一级电影免费在线观看| 久久99精品久久久久久琪琪| 欧美综合国产精品久久丁香| 国产日韩欧美自拍| 国产视频在线观看一区二区| 少妇高潮久久久久久潘金莲| 啪一啪鲁一鲁2019在线视频| 亚洲色图欧美制服丝袜另类第一页| 精品亚洲夜色av98在线观看| 精品国产福利在线| 一区二区三区www| 久久人91精品久久久久久不卡| 97免费视频在线| 亚洲免费一在线|