제출 #749442

#제출 시각아이디문제언어결과실행 시간메모리
749442yellowtoad사이버랜드 (APIO23_cyberland)C++17
33 / 100
3088 ms915900 KiB
#include "cyberland.h" #include <iostream> #include <vector> #include <queue> #define edgetype pair<pair<int,int>,long double> #define distype pair<long double,pair<int,int>> #define f first #define s second using namespace std; long long n, m, k, h; pair<int,int> u, v; long double canvis[1][100010], dist[130][100010], w, minn = 1e18; bool vis[130][100010]; vector<edgetype> edge[130][100010]; priority_queue<distype,vector<distype>,greater<distype>> pq; 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) { minn = 1e18; n = N; m = M; k = K; h = H; for (int i = 0; i <= min(k,60LL)*2; i++) for (int j = 0; j < n; j++) edge[i][j].clear(); for (int i = 0; i < m; i++) { edge[0][x[i]].push_back({{0,y[i]},c[i]}); edge[0][y[i]].push_back({{0,x[i]},c[i]}); } for (int i = 0; i < n; i++) { vis[0][i] = 0; canvis[0][i] = 1e18; } vis[0][h] = 1; canvis[0][0] = 0; pq.push({0,{0,0}}); while (pq.size()) { u = pq.top().s; pq.pop(); if (vis[u.f][u.s]) continue; vis[u.f][u.s] = 1; for (int i = 0; i < edge[u.f][u.s].size(); i++) { v = edge[u.f][u.s][i].f; w = edge[u.f][u.s][i].s; if (canvis[v.f][v.s] > canvis[u.f][u.s]+w) { canvis[v.f][v.s] = canvis[u.f][u.s]+w; pq.push({canvis[v.f][v.s],v}); } } } for (int i = 0; i < m; i++) { for (int j = 1; j <= min(k,60LL)*2; j++) { edge[j][x[i]].push_back({{j,y[i]},(long double)c[i]/(1<<(j/2))}); edge[j][y[i]].push_back({{j,x[i]},(long double)c[i]/(1<<(j/2))}); } } for (int i = 0; i < n; i++) { if (arr[i] == 2) for (int j = 1; j < min(k,60LL)*2; ++++j) edge[j][i].push_back({{j+1,i},0}); else for (int j = 0; j < min(k,60LL)*2; ++++j) edge[j][i].push_back({{j+1,i},0}); } for (int i = 0; i < n; i++) { for (int j = 0; j <= min(k,60LL)*2; j++) { vis[j][i] = 0; dist[j][i] = 1e18; } } for (int i = 2; i <= min(k,60LL)*2; i++) vis[i][h] = 1; dist[0][h] = 0; pq.push({0,{0,h}}); while (pq.size()) { u = pq.top().s; pq.pop(); if (vis[u.f][u.s]) continue; vis[u.f][u.s] = 1; for (int i = 0; i < edge[u.f][u.s].size(); i++) { v = edge[u.f][u.s][i].f; w = edge[u.f][u.s][i].s; if (dist[v.f][v.s] > dist[u.f][u.s]+w) { dist[v.f][v.s] = dist[u.f][u.s]+w; pq.push({dist[v.f][v.s],v}); } } } for (int j = 0; j <= min(k,60LL)*2; j++) minn = min(minn,dist[j][0]); for (int i = 0; i < n; i++) if ((arr[i] == 0) && (canvis[0][i] != 1e18)) for (int j = 0; j <= min(k,60LL)*2; j++) minn = min(minn,dist[j][i]); if (minn != 1e18) return minn; else return -1; }

컴파일 시 표준 에러 (stderr) 메시지

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:38:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, long double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for (int i = 0; i < edge[u.f][u.s].size(); i++) {
      |                         ~~^~~~~~~~~~~~~~~~~~~~~~~
cyberland.cpp:71:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, long double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |         for (int i = 0; i < edge[u.f][u.s].size(); i++) {
      |                         ~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...