#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define REP(x, n) for(int x = 0; x < n; x++)
#define FOR(x, b, e) for (int x = (b); x <= (e); x++)
#define LL long long
#define ULL unsigned long long
#define MP std::make_pair
#define ST first
#define ND second
#define MAX 406
typedef std::pair<int, int> PII;
typedef std::vector<int> VI;
using namespace std;
int main(){
std::ios_base::sync_with_stdio(false);
std::vector<PII> v;
int n, r,c, jx,jy,kx,ky;
cin>>n;
REP(x,n){
cin>>r>>c;
v.push_back(MP(r,c));
}
REP(limak,n){
std::vector<PII> vaux;
vaux = v;
REP(j,n){//tura
if (j == limak)
continue;
REP(k, n){
if (k == limak)
continue;
jx = vaux[j].ST;
jy = vaux[j].ND;
kx = vaux[k].ST;
ky = vaux[k].ND;
if (jx>kx)
kx++;
else{
if(jx < kx)
kx--;
}
if (jy>ky)
ky++;
else{
if(jy < ky)
ky--;
}
vaux[k] = MP(kx,ky);
// cout<< limak << " " <<j <<" " << px<< " "<< py<<endl;
}
}
LL wynik = 0;
REP(x,n){
r= vaux[x].ST;
c= vaux[x].ND;
wynik += r * c;
// cout<< x <<" " << r<< " "<< c<<endl;
}
cout<<wynik<<endl;
}
return 0;
}
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 59 60 61 62 63 64 65 66 67 68 | #include <iostream> #include <algorithm> #include <vector> #include <cmath> #define REP(x, n) for(int x = 0; x < n; x++) #define FOR(x, b, e) for (int x = (b); x <= (e); x++) #define LL long long #define ULL unsigned long long #define MP std::make_pair #define ST first #define ND second #define MAX 406 typedef std::pair<int, int> PII; typedef std::vector<int> VI; using namespace std; int main(){ std::ios_base::sync_with_stdio(false); std::vector<PII> v; int n, r,c, jx,jy,kx,ky; cin>>n; REP(x,n){ cin>>r>>c; v.push_back(MP(r,c)); } REP(limak,n){ std::vector<PII> vaux; vaux = v; REP(j,n){//tura if (j == limak) continue; REP(k, n){ if (k == limak) continue; jx = vaux[j].ST; jy = vaux[j].ND; kx = vaux[k].ST; ky = vaux[k].ND; if (jx>kx) kx++; else{ if(jx < kx) kx--; } if (jy>ky) ky++; else{ if(jy < ky) ky--; } vaux[k] = MP(kx,ky); // cout<< limak << " " <<j <<" " << px<< " "<< py<<endl; } } LL wynik = 0; REP(x,n){ r= vaux[x].ST; c= vaux[x].ND; wynik += r * c; // cout<< x <<" " << r<< " "<< c<<endl; } cout<<wynik<<endl; } return 0; } |
English