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

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.

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

#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會超時。。。
                }

            }

        }

        
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 閱讀(638) 評論(0)  編輯 收藏 引用 所屬分類: 計算幾何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>
            久久精品视频在线免费观看| 性欧美18~19sex高清播放| 亚洲欧美高清| 日韩视频一区二区在线观看| 亚洲国产欧美日韩精品| 韩日成人在线| 在线国产日韩| 亚洲三级视频| 一本久道综合久久精品| 一区二区三区欧美日韩| 亚洲欧美视频在线| 久久久久久一区| 欧美aⅴ99久久黑人专区| 欧美二区不卡| 一区二区三区四区在线| 欧美一区二区三区免费看| 久久精品视频一| 欧美激情一区二区三区| 国产精品天美传媒入口| 一色屋精品视频在线看| 亚洲人成毛片在线播放女女| 亚洲小说区图片区| 久久久99精品免费观看不卡| 欧美精品在线观看| 欧美视频一区二区三区在线观看| 国产女主播一区| 亚洲人成啪啪网站| 欧美一级黄色网| 亚洲第一在线视频| 亚洲在线电影| 欧美精品在线一区二区| 国产一区二区三区久久久久久久久| 亚洲激情在线观看视频免费| 午夜精品亚洲| 亚洲免费播放| 蜜桃久久av一区| 国产亚洲日本欧美韩国| 在线视频精品一| 欧美成年视频| 欧美中文日韩| 国产精品网红福利| 中国日韩欧美久久久久久久久| 久久一区二区视频| 亚洲专区欧美专区| 亚洲视频欧洲视频| 久久不射2019中文字幕| 久久婷婷综合激情| 亚洲香蕉在线观看| 欧美日韩三级视频| 亚洲欧洲一区二区在线观看| 久久成人免费电影| 在线一区观看| 欧美破处大片在线视频| 激情成人av在线| 久久精品国产亚洲一区二区三区| 亚洲毛片在线看| 欧美激情精品久久久久久大尺度| 在线观看精品视频| 免费成人在线观看视频| 久久精品在线观看| 在线观看一区视频| 欧美大色视频| 欧美成人国产一区二区| 一区福利视频| 欧美国产日韩精品| 欧美高清视频| 99视频超级精品| 亚洲看片免费| 国产精品日韩久久久| 亚洲欧美在线x视频| 亚洲欧美电影在线观看| 国产亚洲欧洲997久久综合| 久久久久久久综合日本| 久久久久久久久伊人| 亚洲国产精品第一区二区三区| 久久久久久久999精品视频| 韩国av一区二区三区在线观看 | 亚洲国产精品999| 欧美91精品| 欧美日韩激情小视频| 欧美一级大片在线观看| 欧美在线影院| 日韩亚洲欧美一区| 亚洲午夜91| 在线观看日产精品| 亚洲麻豆国产自偷在线| 国产欧美一区二区三区视频| 久热精品视频在线观看一区| 久久尤物视频| 亚洲视频网站在线观看| 久久成人在线| 国产精品99久久久久久有的能看| 亚洲一区二区免费看| 亚洲大片一区二区三区| 亚洲精品九九| 国产一区二区三区在线观看精品| 欧美激情网友自拍| 国产精品久久久久久影视| 久久久综合视频| 欧美午夜影院| 欧美激情1区2区3区| 国产噜噜噜噜噜久久久久久久久| 免费观看亚洲视频大全| 国产精品久久一区主播| 欧美一区二区三区在线| 玖玖玖国产精品| 欧美精品一区二| 久久成人精品电影| 欧美久久一级| 久久综合久久综合这里只有精品| 欧美激情一区二区三区全黄| 久久精品国产久精国产一老狼 | 欧美大片免费观看| 欧美综合二区| 欧美色综合天天久久综合精品| 欧美xxxx在线观看| 国产精品午夜av在线| 亚洲激情在线观看视频免费| 国产伪娘ts一区| 在线视频欧美日韩| 一区二区三区久久久| 久热精品视频在线观看一区| 欧美一区二区三区四区视频| 欧美日韩精品综合| 亚洲国产欧美不卡在线观看| 伊人婷婷欧美激情| 欧美一区二区三区在线看| 亚洲手机成人高清视频| 欧美精品一区二区久久婷婷| 欧美激情四色| 亚洲激情在线观看| 久久成人综合网| 久久九九精品99国产精品| 国产欧美一区二区三区视频| 一区二区三区www| 一区二区三欧美| 欧美精品入口| 一本一本a久久| 亚洲欧美www| 国产伦精品一区| 久久成人人人人精品欧| 蜜桃伊人久久| 亚洲人成毛片在线播放| 欧美极品在线观看| 一区二区电影免费观看| 亚洲欧美日本日韩| 国产一区白浆| 猫咪成人在线观看| 亚洲国产成人在线| 中国av一区| 国产伦精品一区二区三区照片91| 亚洲欧美日韩国产综合| 久久偷窥视频| 亚洲人成网站色ww在线| 欧美久久电影| 亚洲在线视频观看| 久久人人爽国产| 91久久中文字幕| 欧美日韩一卡二卡| 亚洲欧美久久| 欧美成人免费全部| 一本综合久久| 国产精品女人久久久久久| 欧美综合国产精品久久丁香| 欧美成人精品h版在线观看| 一本色道久久99精品综合| 国产精品视频观看| 久久影音先锋| avtt综合网| 免费观看日韩av| 亚洲三级性片| 欧美日韩精品系列| 亚洲丰满在线| 亚洲欧美日本国产专区一区| 国产一区日韩一区| 欧美日本不卡视频| 亚洲欧美一区二区激情| 欧美高清视频一区二区| 亚洲欧美日韩国产中文 | 久久精品夜夜夜夜久久| 亚洲电影免费观看高清完整版| 亚洲手机成人高清视频| 一色屋精品视频在线观看网站| 欧美日韩一区高清| 久久免费国产| 亚洲专区一区| 亚洲精品少妇网址| 玖玖玖国产精品| 欧美一级片一区| 99在线精品视频| 亚洲国产精品久久久| 国产亚洲成人一区| 国产精品成人一区二区网站软件 | 99这里有精品| 在线观看精品| 国产亚洲精品7777| 国产精品三区www17con| 欧美日韩国产欧美日美国产精品| 欧美专区在线播放| 午夜精品区一区二区三|