Submission
Status:
PPPPPTTTTT
Score: 50
User: ShynyC
Problemset: กางเต็นท์
Language: cpp
Time: 1.094 second
Submitted On: 2025-04-19 21:05:15
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
int main(){
int n,a,b,maxnum = INT_MIN,max = 0;
pair<int,int> locations;
vector<pair<int,int> > vec;
cin >> n;
for(int i = 0; i < n; i++){
cin >> a >> b;
if(a > maxnum){
maxnum = a;
}
if(b > maxnum){
maxnum = b;
}
locations.first = a;
locations.second = b;
vec.push_back(locations);
}
sort(vec.begin(),vec.end());
for(int i = 0; i < n-1; i++){
for(int j = 0; j < n; j++){
if(i != j){
for(int k = max; k < maxnum; k++){
if(vec[i].first+k == vec[j].first && vec[i].second+k == vec[j].second){
max = k;
//cout << vec[i].first << " " << vec[i].second << "\n";
}else if(vec[i].first+k == vec[j].first && vec[i].second-k == vec[j].second){
max = k;
//cout << vec[i].first << " " << vec[i].second << "\n";
}
}
}
}
}
cout << max;
}