#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define ll long long
#define OK puts("OK")
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
using namespace std;
const int N = 3e5+10;
const int inf = 1e9+7;
int x[N] , y [N] , cnt ;
double a , b , c ;
int main() {
int n ;
cin >> n ;
for (int i = 0 ;i < n ;i ++ )
{
cin >> x [i] >> y [i] ;
}
for (int i = 0 ;i < n - 2 ; i ++ )
{
for (int j = i + 1 ;j < n - 1 ; j ++ )
{
for (int z = j + 1 ; z < n ; z ++ )
{
vector < double > v;
a = sqrt ( (x [i] - x [j] ) * (x [i] - x [j] ) + (y [i] - y [j] ) * (y [i] - y [j] )) ;
b = sqrt ( (x [i] - x [z] ) * (x [i] - x [z] ) + (y [i] - y [z] ) * (y [i] - y [z] )) ;
c = sqrt ( (x [z] - x [j] ) * (x [z] - x [j] ) + (y [z] - y [j] ) * (y [z] - y [j] )) ;
// cout << a << ' ' << b << ' ' << c << endl;
v.pb(a);
v.pb(b);
v.pb(c);
sort (all (v)) ;
if (v[0] + v[1] > v[2])
cnt ++ ;
}
}
}
cout << cnt ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
472 KB |
Output is correct |
3 |
Correct |
2 ms |
472 KB |
Output is correct |
4 |
Incorrect |
2 ms |
472 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |