# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
777168 | 2023-07-08T18:25:57 Z | groshi | 사이버랜드 (APIO23_cyberland) | C++17 | 3000 ms | 199240 KB |
#include<bits/stdc++.h> #include "cyberland.h" #define int long long using namespace std; struct wi{ vector<int> Q; double dp[203]; int co; int odw=0; }*w; vector<int> moge; void dfs(int x,int nie) { w[x].odw=1; if(x==nie) return; if(w[x].co==0) moge.push_back(x); for(int i=0;i<w[x].Q.size();i+=2) if(w[w[x].Q[i]].odw==0) dfs(w[x].Q[i],nie); } double solve(int32_t n,int32_t m,int32_t k,int32_t h,vector<int32_t> x,vector<int32_t> y,vector<int32_t> c, vector<int32_t> arr) { w=new wi[n+3]; for(int i=0;i<m;i++) { w[x[i]].Q.push_back(y[i]); w[y[i]].Q.push_back(x[i]); w[x[i]].Q.push_back(c[i]); w[y[i]].Q.push_back(c[i]); } for(int i=0;i<n;i++) w[i].co=arr[i]; moge.clear(); dfs(0,h); moge.push_back(0); priority_queue<pair<double,pair<int,int> > > kolejka; k=min(k,200); for(int i=0;i<n;i++) for(int j=0;j<=k;j++) w[i].dp[j]=1e18; for(int i=0;i<moge.size();i++) kolejka.push({0.0,{moge[i],0}}),w[moge[i]].dp[0]=0; while(!kolejka.empty()) { auto para=kolejka.top(); kolejka.pop(); int x=para.second.first; int typ=para.second.second; double ile=para.first; if(ile>w[x].dp[typ]) continue; if(x==h) continue; for(int i=0;i<w[x].Q.size();i+=2) { int pom=w[x].Q[i]; double dodaj=w[x].Q[i+1]; if(w[pom].dp[typ]>ile+dodaj) kolejka.push({ile+dodaj,{pom,typ}}),w[pom].dp[typ]=ile+dodaj; if(w[pom].co!=2) continue; dodaj+=ile; dodaj/=2; if(w[pom].dp[typ+1]>dodaj && typ+1<=k) kolejka.push({dodaj,{pom,typ+1}}),w[pom].dp[typ+1]=dodaj; } } double minn=1e18; for(int i=0;i<=k;i++) minn=min(minn,w[h].dp[i]); if(minn==1e18) return -1; else return minn; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 90768 KB | Correct. |
2 | Correct | 48 ms | 90912 KB | Correct. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 44 ms | 75608 KB | Correct. |
2 | Correct | 51 ms | 91208 KB | Correct. |
3 | Correct | 50 ms | 86644 KB | Correct. |
4 | Correct | 51 ms | 89836 KB | Correct. |
5 | Correct | 51 ms | 90108 KB | Correct. |
6 | Correct | 42 ms | 68692 KB | Correct. |
7 | Correct | 53 ms | 91128 KB | Correct. |
8 | Correct | 23 ms | 34128 KB | Correct. |
9 | Correct | 51 ms | 92096 KB | Correct. |
10 | Correct | 52 ms | 90644 KB | Correct. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 55 ms | 87372 KB | Correct. |
2 | Correct | 53 ms | 85600 KB | Correct. |
3 | Correct | 49 ms | 80436 KB | Correct. |
4 | Correct | 54 ms | 92452 KB | Correct. |
5 | Correct | 54 ms | 92460 KB | Correct. |
6 | Correct | 12 ms | 14440 KB | Correct. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3061 ms | 104628 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 135 ms | 85196 KB | Correct. |
2 | Correct | 141 ms | 88252 KB | Correct. |
3 | Correct | 151 ms | 87260 KB | Correct. |
4 | Correct | 1032 ms | 67260 KB | Correct. |
5 | Correct | 61 ms | 91700 KB | Correct. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 57 ms | 87984 KB | Correct. |
2 | Correct | 59 ms | 77312 KB | Correct. |
3 | Correct | 84 ms | 131280 KB | Correct. |
4 | Correct | 60 ms | 64448 KB | Correct. |
5 | Correct | 53 ms | 93600 KB | Correct. |
6 | Correct | 54 ms | 80440 KB | Correct. |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3081 ms | 29420 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3071 ms | 199240 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |