青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

Pick-up sticks
Time Limit: 3000MS Memory Limit: 65536K
Total Submissions: 4189 Accepted: 1501

Description

Stan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan tries to find the top sticks, that is these sticks such that there is no stick on top of them. Stan has noticed that the last thrown stick is always on top but he wants to know all the sticks that are on top. Stan sticks are very, very thin such that their thickness can be neglected.                                                             
                                                                                                                                                                                      

Input

Input consists of a number of cases. The data for each case start with 1 <= n <= 100000, the number of sticks for this case. The following n lines contain four numbers each, these numbers are the planar coordinates of the endpoints of one stick. The sticks are listed in the order in which Stan has thrown them. You may assume that there are no more than 1000 top sticks. The input is ended by the case with n=0. This case should not be processed.

Output

For each input case, print one line of output listing the top sticks in the format given in the sample. The top sticks should be listed in order in which they were thrown.

The picture to the right below illustrates the first case from input.

Sample Input

5
1 1 4 2
2 3 3 1
1 -2.0 8 4
1 4 8 2
3 3 6 -2.0
3
0 0 1 1
1 0 2 1
2 0 3 1
0

Sample Output

Top sticks: 2, 4, 5.
Top sticks: 1, 2, 3.

Hint

Huge input,scanf is recommended.

/***********************************
暴力就行,從第一個(gè)開始判斷
如果兩條線段相交就把前面一條篩選掉
判斷線段相交直接貼的吉大模板。。。
**********************************
*/

#include 
<iostream>
#include 
<cstdio>
#include 
<cstring>

using namespace std;

const int maxn = 100000 + 5;
const double eps=1e-10;

struct point double x, y; };

point p[maxn], b[maxn];
bool ans[maxn];

double min(double a, double b) return a < b ? a : b; }

double max(double a, double b) return a > b ? a : b; }

bool inter(point a, point b, point c, point d)
{
    
if( min(a.x, b.x) > max(c.x, d.x) ||
        min(a.y, b.y) 
> max(c.y, d.y) ||
        min(c.x, d.x) 
> max(a.x, b.x) ||
        min(c.y, d.y) 
> max(a.y, b.y) )
    
return 0;

    
double h, i, j, k;

    h 
= (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
    i 
= (b.x - a.x) * (d.y - a.y) - (b.y - a.y) * (d.x - a.x);
    j 
= (d.x - c.x) * (a.y - c.y) - (d.y - c.y) * (a.x - c.x);
    k 
= (d.x - c.x) * (b.y - c.y) - (d.y - c.y) * (b.x - c.x);

    
return h * i <= eps && j * k <= eps;
}


int main()
{
    
int n;
    
int res[maxn];
    
while( cin >> n, n )
    
{
        memset( ans, 
0sizeof( ans ) );
        
forint i = 0; i < n; i++ )
        
{
            cin 
>> p[i].x >> p[i].y >> b[i].x >> b[i].y;
        }


        
forint i = 0; i < n; i++ )
        
{
            
forint j = i + 1; j < n; j++ )
            
{
                
if( inter(p[i], b[i], p[j], b[j] ) )
                
{
                    ans[i] 
= 1;
                    
break;              //不加break會(huì)超時(shí)。。。
                }

            }

        }

        
int ct = 0;
        cout 
<< "Top sticks: ";
        
forint i = 0; i < n; i++ )
            
if!ans[i] )  res[ct++= i + 1;
        
forint i = 0; i < ct - 1; i++ )
            cout 
<< res[i] << "";
        cout 
<< res[ct-1<< "." << endl;
    }

    
return 0;
}

posted on 2010-10-03 16:21 Vontroy 閱讀(639) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 計(jì)算幾何 、POJ
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美日韩国产黄| 午夜精品视频| 一区二区三区四区五区精品视频| 久久国产主播精品| 久久国产欧美| 久久久久久午夜| 美女网站久久| 亚洲电影在线看| 欧美不卡视频一区发布| 欧美成人日韩| 日韩小视频在线观看专区| 一区二区三区视频免费在线观看 | 久久久精品国产99久久精品芒果| 午夜一区在线| 欧美成人一区二区三区在线观看 | 洋洋av久久久久久久一区| 一区二区黄色| 久久久成人精品| 亚洲日本激情| 先锋影音久久| 欧美国产91| 国产午夜精品理论片a级大结局| 红桃视频成人| 亚洲性视频网址| 久久久亚洲精品一区二区三区 | 久久亚洲二区| 国产精品xxx在线观看www| 国外成人网址| 亚洲综合社区| 亚洲第一区中文99精品| 亚洲一区视频在线| 蜜臀a∨国产成人精品| 国产精品美女一区二区在线观看| 精久久久久久| 亚洲欧美日韩电影| 亚洲国产精品久久久久久女王| 亚洲欧美日韩国产综合| 欧美日韩精品欧美日韩精品| 亚洲高清在线播放| 久久久精品999| 亚洲一区二区三区在线| 欧美精品一区三区在线观看| 激情婷婷欧美| 久久久精品一区二区三区| 亚洲午夜三级在线| 欧美日韩视频不卡| 日韩一二三在线视频播| 另类亚洲自拍| 午夜亚洲激情| 国产女人精品视频| 午夜精品婷婷| 亚洲视频免费| 欧美午夜免费影院| 久热精品视频| 国产亚洲精品资源在线26u| 亚洲一区成人| 亚洲久色影视| 欧美精品激情在线| 亚洲精品久久久久| 欧美福利在线| 狂野欧美一区| 在线日韩电影| 欧美成年人网| 麻豆久久精品| 亚洲人久久久| 亚洲激情视频| 欧美日韩免费在线| 亚洲一区中文字幕在线观看| 亚洲美女中文字幕| 国产精品久久久久7777婷婷| 午夜精品福利视频| 欧美一级电影久久| 在线播放豆国产99亚洲| 欧美黄色aaaa| 欧美日韩午夜在线视频| 亚洲一区日韩在线| 欧美一区不卡| 在线日韩av永久免费观看| 欧美激情一区二区三区高清视频 | 欧美午夜片在线观看| 亚洲欧美在线一区二区| 亚洲欧美日韩国产一区二区三区| 狠狠v欧美v日韩v亚洲ⅴ| 亚洲第一精品福利| 欧美日韩国产综合久久| 久久不射2019中文字幕| 久久一区中文字幕| 一本大道av伊人久久综合| 亚洲视频导航| 在线欧美日韩| 亚洲午夜电影网| 亚洲国产导航| 一本色道久久加勒比88综合| 国产日韩欧美夫妻视频在线观看| 免费视频最近日韩| 国产精品日韩久久久久| 欧美电影打屁股sp| 国产精品久久婷婷六月丁香| 久久综合亚洲社区| 欧美少妇一区| 欧美不卡在线| 国产日韩欧美自拍| 日韩视频亚洲视频| 黄色精品一区| 一本一本a久久| 极品中文字幕一区| 亚洲淫片在线视频| 中国成人在线视频| 久久夜色精品国产欧美乱| 香蕉久久国产| 欧美日韩亚洲一区三区| 亚洲国产三级在线| 一区二区三区欧美视频| 亚洲精品1区2区| 午夜精品久久久久久久久| 一本色道久久加勒比精品| 久久精品综合网| 欧美在线一二三区| 欧美午夜精品一区| 亚洲精品综合久久中文字幕| 在线观看日韩精品| 亚洲欧美在线一区二区| 99国产精品久久久久老师| 久久亚洲图片| 久久一区亚洲| 国内精品美女av在线播放| 亚洲一区久久久| 一区二区三区高清在线| 免费看的黄色欧美网站| 久久一区二区三区国产精品| 国产欧美日韩亚州综合| 亚洲视频网在线直播| 一区二区毛片| 欧美日韩系列| 一本色道久久综合亚洲二区三区| av成人福利| 欧美国产一区二区三区激情无套| 久久综合色婷婷| 在线电影院国产精品| 久久久免费观看视频| 久久亚洲综合色一区二区三区| 国精品一区二区| 久久久久久久精| 老鸭窝91久久精品色噜噜导演| 国户精品久久久久久久久久久不卡| 欧美一级午夜免费电影| 久久精品日韩欧美| 好吊一区二区三区| 欧美电影在线观看| 99精品国产一区二区青青牛奶| 亚洲天堂av电影| 国产精品一区二区三区观看| 西瓜成人精品人成网站| 美女免费视频一区| 日韩视频一区| 国产精品国产三级国产aⅴ浪潮| 亚洲一区免费网站| 鲁大师影院一区二区三区| 亚洲黄网站在线观看| 欧美日产国产成人免费图片| 亚洲影视在线播放| 欧美jizzhd精品欧美巨大免费| 亚洲精品美女久久7777777| 欧美日韩亚洲综合在线| 一区二区三区久久网| 久久精品国产77777蜜臀| 黑人操亚洲美女惩罚| 欧美区日韩区| 欧美一区二区| 亚洲国产精品专区久久| 亚洲欧美一区二区精品久久久| 国产亚洲a∨片在线观看| 欧美成人午夜视频| 午夜精品久久久| 亚洲国产精品久久| 久久精品视频导航| 一本色道久久综合亚洲精品按摩| 国产伦精品一区二区三区视频孕妇| 久久久亚洲午夜电影| 亚洲无毛电影| 亚洲日本一区二区三区| 欧美一级精品大片| 日韩视频二区| 亚洲国产婷婷香蕉久久久久久99| 黄色亚洲免费| 欧美精品在线观看91| 小黄鸭精品aⅴ导航网站入口| 亚洲国产精品久久精品怡红院| 小嫩嫩精品导航| 亚洲欧洲视频| 国内自拍亚洲| 国产美女高潮久久白浆| 欧美精品一区三区| 巨乳诱惑日韩免费av| 亚洲永久网站| 日韩西西人体444www| 亚洲激情在线视频| 欧美国产日韩亚洲一区| 久久精品一区二区国产| 亚洲影院污污.|