Submission #735619

#TimeUsernameProblemLanguageResultExecution timeMemory
735619myrcellaIdeal city (IOI12_city)C++17
0 / 100
930 ms8988 KiB
//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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...