Submission #523435

#TimeUsernameProblemLanguageResultExecution timeMemory
523435tatoGeometrija (COCI21_geometrija)C++14
0 / 110
1 ms296 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define fs first #define sc second #define pii pair<int,int> using namespace std; pii a[1001]; int check(pii vect, pii pt, pii npt) { int A = vect.sc; int B = (-1)*vect.fs; int C = (-1)*A*(pt.fs) - B*(pt.sc); if((A*npt.fs + B*npt.sc + C) > 0) return 1; else if((A*npt.fs + B*npt.sc + C) < 0) return 2; else return 0; } void answer() { int n; int cnt = 0; cin >> n; for(int i = 1; i <= n; i++) cin >> a[i].fs >> a[i].sc; for(int i = 1; i < n; i++) { for(int j = i + 1; j <= n; j++) { pii vect ; vect.fs = a[i].fs - a[j].fs; vect.sc = a[i].sc - a[j].sc; int indx1 = 0, indy1 = 0, ind_x1 = 0, ind_y1 = 0; for(int k = 1; k <= n; k++) { int ind = check(vect, a[i], a[k]); if((a[i].fs <= a[k].fs and a[j].fs >= a[k].fs) or (a[i].fs >= a[k].fs and a[j].fs <= a[k].fs)) { if(ind == 1) indx1 = 1; if(ind == 2) ind_x1 = 1; } if((a[i].sc <= a[k].sc and a[j].sc >= a[k].sc) or (a[i].sc >= a[k].sc and a[j].sc <= a[k].sc)) { if(ind == 1) indy1 = 1; if(ind == 2) ind_y1 = 1; } } if((indx1 == 0 or ind_x1 == 0) and (indy1 == 0 or ind_y1 == 0)) cnt++; } } cout << cnt; } int main() { int t = 1; //cin >> t; while(t--) answer(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...