# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
86988 | rakuten | Star triangles (IZhO11_triangle) | C++14 | 3 ms | 472 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |