-
-
Notifications
You must be signed in to change notification settings - Fork 300
/
1037.cpp
72 lines (63 loc) · 1.64 KB
/
1037.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
__________________________________________________________________________________________________
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stdio.h>
#include <stack>
#include <ctime>
#include <list>
#include <map>
#include <set>
#include <assert.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define TR(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(ALL(x))
#define CLEAR(x) memset(x,0,sizeof(x))
#define FILL(x,c) memset(x,c,sizeof(x))
using namespace std;
const double eps = 1e-8;
#define PB push_back
#define MP make_pair
typedef map<int,int> MII;
typedef map<string,int> MSI;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<long double> VD;
typedef pair<int,int> PII;
typedef long long int64;
typedef long long LL;
typedef unsigned int UI;
typedef long double LD;
typedef unsigned long long ULL;
int det(VI a, VI b) {
return a[1] * b[0] - a[0] * b[1];
}
VI minus_(VI a, VI b) {
VI c;
c.PB(a[0] - b[0]);
c.PB(a[1] - b[1]);
return c;
}
class Solution {
public:
bool isBoomerang(vector<vector<int>>& p) {
return det(minus_(p[1], p[0]), minus_(p[2], p[0])) != 0;
}
};
__________________________________________________________________________________________________
__________________________________________________________________________________________________