이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define X first
#define Y second
#define pb(x) push_back(x)
ll n, a[101], a1[101], r, r1, c[20];
pair<ll, ll> p[101];
bool b[101];
int main(){
// ios_base::sync_with_stdio(0);
// cin.tie(0);
cin >> n;
for(int i=0; i<n; i++){
a1[i]=-1;
cin >> p[i].X >> p[i].Y;
}
for(int hj=0; hj<4; hj++){
a1[0]=hj;
a[0]=0;
b[0]=0;
r1=1;
for(int i=1; i<n; i++){
a1[0]=-1;
a[0]=1000000000000000ll;
b[i]=0;
}
for(int i=0; i<n; i++){
c[0]=1000000000000000ll;
c[1]=0;
for(int t=0; t<n; t++){
if(!b[t]){
if(a[t]<c[0]){
c[0]=a[t];
c[1]=t;
}
}
}
if(c[0]==1000000000000000ll)break;
b[c[1]]=1;
for(int t=0; t<n; t++){
if(!b[t]){
if(a1[c[1]]==0){
if(p[c[1]].X-p[t].X==p[t].Y-p[c[1]].Y&&p[c[1]].X-p[t].X>=a[c[1]]){
if(a1[t]==-1){
r1++;
a1[t]=1;
}
a[t]=min(a[t], p[c[1]].X-p[t].X);
}
if(p[t].X-p[c[1]].X==p[t].Y-p[c[1]].Y&&p[t].X-p[c[1]].X>=a[c[1]]){
if(a1[t]==-1){
r1++;
a1[t]=3;
}
a[t]=min(a[t], p[t].X-p[c[1]].X);
}
}
if(a1[c[1]]==1){
if(p[t].X-p[c[1]].X==p[t].Y-p[c[1]].Y&&p[t].X-p[c[1]].X>=a[c[1]]){
if(a1[t]==-1){
r1++;
a1[t]=2;
}
a[t]=min(a[t], p[t].X-p[c[1]].X);
}
if(p[c[1]].X-p[t].X==p[t].Y-p[c[1]].Y&&-(p[c[1]].X-p[t].X)>=a[c[1]]){
if(a1[t]==-1){
r1++;
a1[t]=0;
}
a[t]=min(a[t], -(p[c[1]].X-p[t].X));
}
}
if(a1[c[1]]==2){
if(p[c[1]].X-p[t].X==p[t].Y-p[c[1]].Y&&-(p[c[1]].X-p[t].X)>=a[c[1]]){
if(a1[t]==-1){
r1++;
a1[t]=3;
}
a[t]=min(a[t], -(p[c[1]].X-p[t].X));
}
if(p[t].X-p[c[1]].X==p[t].Y-p[c[1]].Y&&-(p[t].X-p[c[1]].X)>=a[c[1]]){
if(a1[t]==-1){
r1++;
a1[t]=1;
}
a[t]=min(a[t], -(p[t].X-p[c[1]].X));
}
}
if(a1[c[1]]==2){
if(p[t].X-p[c[1]].X==p[t].Y-p[c[1]].Y&&-(p[t].X-p[c[1]].X)>=a[c[1]]){
if(a1[t]==-1){
r1++;
a1[t]=0;
}
a[t]=min(a[t], -(p[t].X-p[c[1]].X));
}
if(p[c[1]].X-p[t].X==p[t].Y-p[c[1]].Y&&p[c[1]].X-p[t].X>=a[c[1]]){
if(a1[t]==-1){
r1++;
a1[t]=2;
}
a[t]=min(a[t], p[c[1]].X-p[t].X);
}
}
}
}
}
r=max(r, r1);
}
cout << r;
return 0;
}
/*
2
0 0
4 3
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |