# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1105395 | 2024-10-26T09:29:11 Z | monaxia | Hotspot (NOI17_hotspot) | C++17 | 29 ms | 196432 KB |
#include <bits/stdc++.h> #define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0) #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout) #define ll long long #define ull unsigned long long #define i128 __int128 #define db long double #define sz(a) ((int)(a).size()) #define pb emplace_back #define pf emplace_front #define pob pop_back #define pof pop_front #define lb lower_bound #define ub upper_bound #define fi first #define se second #define ins emplace using namespace std; const int MOD = 1e9+7, MAXN = 1e5+5; const string NAME = "TRAINCENTRE"; int n,m,k,x,y; vector<int> adj[5005]; pair<int,int> dist[5005][5005],p[2005]; pair<int,db> rs; int main() { tt; if(fopen((NAME + ".INP").c_str(), "r")) fo; cin >> n >> m; for(int i = 1; i<=m; ++i) cin >> x >> y, ++x, ++y, adj[x].pb(y), adj[y].pb(x); memset(dist,0x3f,sizeof(dist)); for(int i = 1; i<=n; ++i){ queue<int> q; q.push(i), dist[i][i].fi=0, dist[i][i].se=1; while(!q.empty()){ int u = q.front(); for(int v : adj[u]){ if(dist[i][v].fi>dist[i][u].fi+1) dist[i][v].fi=dist[i][u].fi+1, dist[i][v].se=dist[i][u].se, q.push(v); else if(dist[i][v].fi==dist[i][u].fi+1) dist[i][v].se+=dist[i][u].se; } q.pop(); } } cin >> k; for(int i = 1; i<=k; ++i) cin >> p[i].fi >> p[i].se, ++p[i].fi, ++p[i].se; for(int i = 1; i<=n; ++i){ db e=0; for(int j = 1; j<=k; ++j) e+=1.0L*dist[p[j].fi][i].se*dist[p[j].se][i].se/dist[p[i].fi][p[i].se].se; if(e>rs.se) rs.fi=i, rs.se=e; } cout << rs.fi+1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 196432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 196432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 196432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 196432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 196432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 196432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |