제출 #73641

#제출 시각아이디문제언어결과실행 시간메모리
73641VardanyanJakarta Skyscrapers (APIO15_skyscraper)C++14
0 / 100
5 ms1328 KiB
//#pragma GCC optimize "-O3" #include <bits/stdc++.h> using namespace std; const int N = 30007; vector<pair<int,int> > g[N]; int B[N],P[N]; int dist[N]; int main() { int n,m; scanf("%d%d",&n,&m); for(int i = 0;i<m;i++){ int b,p; scanf("%d%d",&b,&p); int bb = b; int c = 1; while(bb+p<n){ bb+=p; g[b].push_back({bb,c}); c++; } bb = b; c = 1; while(bb-p>=0){ bb-=p; g[b].push_back({bb,c}); c++; } } priority_queue<pair<int,int> > pq; dist[0] = 0; for(int i = 1;i<=n;i++) dist[i] = 1000*1000*1000+7; pq.push({0,0}); while(!pq.empty()){ pair<int,int> v = pq.top(); pq.pop(); int gag = v.second; for(int i = 0;i<g[gag].size();i++){ int to = g[gag][i].first; int d = g[gag][i].second; if(d+(-v.first)<dist[to]){ dist[to] = d+(-v.first); pq.push({-dist[to],to}); } } } cout<<dist[1]<<endl; return 0; }

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

skyscraper.cpp: In function 'int main()':
skyscraper.cpp:38:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 0;i<g[gag].size();i++){
                       ~^~~~~~~~~~~~~~
skyscraper.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
skyscraper.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&b,&p);
         ~~~~~^~~~~~~~~~~~~~
#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...