제출 #935410

#제출 시각아이디문제언어결과실행 시간메모리
935410tamir1Jakarta Skyscrapers (APIO15_skyscraper)C++17
10 / 100
1 ms1368 KiB
#include<bits/stdc++.h> #define ll long long #define ff first #define ss second using namespace std; ll n,m,i,j,dist[30005],b[30005],p[30005],x,y; vector<pair<ll,ll>> v[30005]; bitset<30005> vis; set<pair<ll,ll>> q; int main(){ cin >> n >> m; for(i=0;i<m;i++){ cin >> b[i] >> p[i]; x=b[i]+p[i]; y=0; while(x<n){ y++; v[b[i]].push_back({x,y}); x+=p[i]; } x=b[i]-p[i]; y=0; while(x>=0){ y++; v[b[i]].push_back({x,y}); x-=p[i]; } } q.insert({0,b[0]}); while(!q.empty()){ auto z=*q.begin(); x=z.ss; y=z.ff; q.erase(q.begin()); if(vis[x]) continue; dist[x]=-y; vis[x]=1; for(i=0;i<v[x].size();i++){ if(!vis[v[x][i].ff]){ q.insert({y-v[x][i].ss,v[x][i].ff}); } } } if(vis[b[1]]) cout << dist[b[1]]; else cout << -1; }

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

skyscraper.cpp: In function 'int main()':
skyscraper.cpp:38:12: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for(i=0;i<v[x].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...