Submission #86989

#TimeUsernameProblemLanguageResultExecution timeMemory
86989rakutenStar triangles (IZhO11_triangle)C++14
0 / 100
2 ms532 KiB
#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 timeMemoryGrader output
Fetching results...