-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path019-sorted-pairwise-distance-list.cpp
More file actions
58 lines (56 loc) · 1.45 KB
/
Copy path019-sorted-pairwise-distance-list.cpp
File metadata and controls
58 lines (56 loc) · 1.45 KB
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
/*
* Sorted Pairwise Distance List [103053A]
* Problem: Gym/ICPC contest 103053 - problem A
* Verdict: ACCEPTED Solved: 2023-07-17
* Language: C++20 (GCC 11-64)
* Runtime: 826 ms Memory: 700 KB
* Tags: n/a
* Author: BidoTeima
* Source: https://codeforces.com/gym/103053/submission/214188126
*/
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n,q;
cin>>n>>q;
ll x[n],y[n];
for(int i = 0; i < n; i++){
cin>>x[i]>>y[i];
}
while(q--){
ll idx,nx,ny;
cin>>idx>>nx>>ny;
vector<ll>a,b;
for(int i = 0; i < n; i++){
if(i == idx)continue;
a.push_back((x[i] - nx) * (x[i] - nx) + (y[i] - ny) * (y[i] - ny));
b.push_back((x[i] - x[idx]) * (x[i] - x[idx]) + (y[i] - y[idx]) * (y[i] - y[idx]));
}
sort(a.begin(),a.end()),sort(b.begin(),b.end());
x[idx]=nx,y[idx]=ny;
bool smaller=0,larger=0;
for(int i = 0; i < (int)a.size(); i++){
if(a[i] < b[i]){
smaller = 1;
break;
}
else if(a[i] > b[i]){
larger = 1;
break;
}
}
if(smaller){
cout<<"smaller\n";
}
else if(larger){
cout<<"larger\n";
}
else{
cout<<"equal\n";
}
}
return 0;
}