답안 #735619

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
735619 2023-05-04T12:04:53 Z myrcella 이상적인 도시 (IOI12_city) C++17
0 / 100
930 ms 8988 KB
//by szh
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000000
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}

const int maxn = 1e3+10;

pii city[maxn];
int ans = 0;
int n;
vector <int> edge[maxn];
int sz[maxn];
map <pii,int> id;
int vis[maxn];
int dis[maxn][maxn];

int DistanceSum(int N,int *X,int *Y) {
	memset(dis,inf,sizeof(dis));
	rep(i,0,N) dis[i][i] = 0;
	rep(i,0,N) 
		rep(j,0,N) if (abs(city[i].fi-city[j].fi) + abs(city[i].se-city[j].se) == 1) dis[i][j] = 1;
	rep(k,0,N)
		rep(i,0,N)
			rep(j,0,N) dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
	int ret = 0;
	rep(i,0,N)
		rep(j,0,i) inc(ret,dis[i][j]);
	return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 930 ms 4320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 8924 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 10 ms 8988 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -