-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Spit_Problem.cpp
More file actions
33 lines (32 loc) · 1.02 KB
/
A_Spit_Problem.cpp
File metadata and controls
33 lines (32 loc) · 1.02 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
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const char nl = '\n';
// Author oGhostyyy
/* Thinking: We need to get reciprocal hits */
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n; cin >> n; //number of camels
vector<pair<int,int>> cameld(n); //vector with posistion and distance data
for(int i = 0; i < n; i++){
cin >> cameld[i].first >> cameld[i].second;
}
int flag = 0;
for(int i = 0; i < n; i++){
for(int j = i+1; j < n; j++){
int x1 = cameld[i].first;
int d1 = cameld[i].second;
int x2 = cameld[j].first;
int d2 = cameld[j].second;
//now we have enough data to see if they hit
if(x1 + d1 == x2 && x2 + d2 == x1){
flag++;
break;
}
}
if(flag) break;
}
if(flag) cout << "YES" << nl;
else cout << "NO" << nl;
}