# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
845130 | 2023-09-06T12:09:43 Z | elotelo966 | Cyberland (APIO23_cyberland) | C++17 | 707 ms | 17736 KB |
#include <bits/stdc++.h> using namespace std; //#define int long long //#define mid (start+end)/2 //#define OYY 10000 //#define faster ios_base::sync_with_stdio(false);cin.tie(NULL); const long double OYY=1e112; double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int>y, std::vector<int> c, std::vector<int> arr){ int n=N; int m=M; int k=K; vector <vector<pair<long long int,long long int>>> v; v.assign(n,{}); k=min(k,50); for(int i=0;i<m;i++){ int a=x[i]; int b=y[i]; int co=c[i]; v[a].push_back({b,co}); v[b].push_back({a,co}); } vector <long double> uza(n,OYY); uza[0]=0; for(int ip=0;ip<=k+2;ip++){ set <pair<long double,int>> st; for(int i=0;i<n;i++){ st.insert({uza[i],i}); } while(!st.empty()){ int node=st.begin()->second; st.erase(st.begin()); if(node==H)continue; for(int i=0;i<v[node].size();i++){ int go=v[node][i].first; int cost=v[node][i].second; if(uza[go]>uza[node]+cost){ st.erase({uza[go],go}); uza[go]=uza[node]+cost; st.insert({uza[go],go}); } } } auto ne=uza; for(int j=0;j<n;j++){ if(uza[j]<OYY){ if(arr[j]==0)ne[j]=0; } else if(arr[j]==2 && ip>1 && ip!=k+2){ for(int i=0;i<v[j].size();i++){ int go=v[j][i].first; int cost=v[j][i].second; ne[go]=min(ne[go],uza[j]/2+(long double)cost); } } } uza=ne; } if(uza[H]<OYY){ return uza[H]; } return -1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 63 ms | 848 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 279 ms | 1396 KB | Correct. |
2 | Correct | 335 ms | 1632 KB | Correct. |
3 | Correct | 322 ms | 1496 KB | Correct. |
4 | Correct | 399 ms | 1680 KB | Correct. |
5 | Correct | 346 ms | 1668 KB | Correct. |
6 | Correct | 390 ms | 3244 KB | Correct. |
7 | Correct | 490 ms | 3228 KB | Correct. |
8 | Correct | 227 ms | 4840 KB | Correct. |
9 | Correct | 202 ms | 1320 KB | Correct. |
10 | Correct | 208 ms | 1644 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 330 ms | 1516 KB | Correct. |
2 | Correct | 327 ms | 1408 KB | Correct. |
3 | Correct | 290 ms | 1740 KB | Correct. |
4 | Correct | 204 ms | 1464 KB | Correct. |
5 | Correct | 203 ms | 1364 KB | Correct. |
6 | Correct | 65 ms | 2208 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 707 ms | 11828 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 268 ms | 1276 KB | Correct. |
2 | Correct | 274 ms | 1740 KB | Correct. |
3 | Correct | 273 ms | 1684 KB | Correct. |
4 | Correct | 291 ms | 2912 KB | Correct. |
5 | Correct | 192 ms | 1360 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 280 ms | 1560 KB | Correct. |
2 | Correct | 246 ms | 1356 KB | Correct. |
3 | Correct | 688 ms | 17736 KB | Correct. |
4 | Correct | 235 ms | 2364 KB | Correct. |
5 | Correct | 220 ms | 1372 KB | Correct. |
6 | Correct | 260 ms | 1488 KB | Correct. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 255 ms | 1364 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 400 ms | 1508 KB | Wrong Answer. |
2 | Halted | 0 ms | 0 KB | - |