hiho week 142 register

Ended

Participants:332

Verdict:Accepted
Score:100 / 100
Submitted:2017-03-22 17:40:38

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
//  main.cpp
//  hiho142
//
//  Created by  on 2017/3/19.
//  Copyright © 2017 . All rights reserved.
//
#include <iostream>
using namespace std;
struct Rect{
    long long left;
    long long right;
    long long top;
    long long down;
};
int containIn(Rect rect,long long *x,long long *y,long long M,int N){
    //    cout<< "rect" << rect.left <<' '<< rect.right <<' ' <<rect.top << ' '<<rect.down<<endl;
    for(int i=0;i<N;i++){
        int a = i;
        int b = i+1;
        if(i == N-1){
            b = 0;
        }
        if(x[a]==x[b]){//
            if(x[a]>=rect.down || x[a]<=rect.top){
                continue;
            }
            if((y[a]-rect.left)*(y[b]-rect.left)<0){//
                return 1;
            }else if((y[a]-rect.right)*(y[b]-rect.right)<0){//
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX