Submission #1652465


Source Code Expand

#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7;
int n,a,b;
bool li[10010][10010]={};
vector<pair<int,int>> vec;

int main(){
	cin >> n;
	REP(i,0,n) cin >> a >> b,vec.push_back(make_pair(a,b)),li[a][b]=true;
	
	int ma=0;
	REP(i,0,n){
		REP(j,0,n){
			if(i!=j){
				int xi=vec[i].first;	int xj=vec[j].first;
				int yi=vec[i].second;	int yj=vec[j].second;
				int x=abs(xj-xi);		int y=abs(yj-yi);
				if(xi-y>=0 and xj-y>=0 and li[xi-y][yi+x] and li[xj-y][yj+x]) ma=max(ma,x*x+y*y);
				if(yi-x>=0 and yj-x>=0 and li[xi+y][yi-x] and li[xj+y][yj-x]) ma=max(ma,x*x+y*y);
			}
		}
	}
	
	cout << ma << endl;
	return 0;
}

Submission Info

Submission Time
Task C - 最古の遺跡
User ecasdqina
Language C++14 (GCC 5.4.1)
Score 20
Code Size 809 Byte
Status AC
Exec Time 157 ms
Memory 47872 KB

Judge Result

Set Name set01 set02 set03 set04 set05 set06 set07 set08 set09 set10
Score / Max Score 2 / 2 2 / 2 2 / 2 2 / 2 2 / 2 2 / 2 2 / 2 2 / 2 2 / 2 2 / 2
Status
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
Set Name Test Cases
set01 data1
set02 data2
set03 data3
set04 data4
set05 data5
set06 data6
set07 data7
set08 data8
set09 data9
set10 data10
Case Name Status Exec Time Memory
data1 AC 2 ms 2432 KB
data10 AC 157 ms 47872 KB
data2 AC 11 ms 47360 KB
data3 AC 5 ms 18688 KB
data4 AC 16 ms 47360 KB
data5 AC 15 ms 47488 KB
data6 AC 15 ms 47488 KB
data7 AC 89 ms 9344 KB
data8 AC 130 ms 47616 KB
data9 AC 146 ms 47744 KB