제출 #777309

#제출 시각아이디문제언어결과실행 시간메모리
777309yeyso사이버랜드 (APIO23_cyberland)C++17
0 / 100
39 ms11976 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; #include <vector> double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { vector<vector<long long>> adj(N, vector<long long>()); vector<vector<long long>> dma(N, vector<long long>()); for(long long i = 0; i < M; i ++){ adj[x[i]].push_back(y[i]); adj[y[i]].push_back(x[i]); dma[x[i]].push_back(c[i]); dma[y[i]].push_back(c[i]); } // parent, node //queue<pair<long long, long long>> q; //long long parent, node; set<long long> to0 = {0}; set<long long> by2 = {}; long long last0 = 0; for(long long i = 0; i < arr.size(); i ++){ if(arr[i] == 0){ to0.insert(i); if(i < H){ last0 = max(last0, i); } } if(arr[i] == 2){ by2.insert(i); } } vector<int> res(N+1, 0); for(int i = 1; i < N+1; i ++){ res[i] = res[i-1] + c[i-1]; if(to0.count(i)){ res[i] = 0; } } for(int i = 0; i < res.size(); i ++){ cout << res[i] << " "; } cout << res[H]; return 0; } /* g++ -std=gnu++17 -O2 -Wall -pipe -static -o cyberland stub_cyberland.cpp cyberland.cpp 1 10 9 10 6 1 1 0 1 2 2 1 0 2 1 0 1 3 1 2 1 2 3 1 3 4 1 4 5 1 5 6 1 6 7 1 7 8 1 8 9 1 node = H; long long dist = 0; q.push({0ll, H}); vector<long long> v(N, 0); visited = v; double closest = long long_MAX / 2; cout << closest; double dt0 = long long_MAX / 2; //vector<long long> dist(N, long long_MAX / 2; while(!q.empty()){ dist = q.front().first; node = q.front().second; q.pop(); if(!visited[node]){ visited[node] = 1; if(to0.count(node)){ closest = min(closest, dist * 1.0); } if(node == 0){ dt0 = dist; } for(long long i = 0; i < adj[node].size(); i ++){ q.push({dist + dma[node][i], adj[node][i]}); } } } return min(closest, dt0);*/

컴파일 시 표준 에러 (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:27:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(long long i = 0; i < arr.size(); i ++){
      |                          ~~^~~~~~~~~~~~
cyberland.cpp:45:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     for(int i = 0; i < res.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...