제출 #239137

#제출 시각아이디문제언어결과실행 시간메모리
239137aggu_01000101Jakarta Skyscrapers (APIO15_skyscraper)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define int long long #define INF 1000000000000000 #define lchild(i) (i*2 + 1) #define rchild(i) (i*2 + 2) #define mid(l, u) ((l+u)/2) #define x(p) p.first #define y(p) p.second #define MOD 998244353 int n, m; using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>n>>m; int s = 0, t= 0; vector<int> adj[n]; map<pair<int, int>, bool> ez; for(int i = 0;i<m;i++){ int b, p; cin>>b>>p; if(!ez[{b, p}]) adj[b].push_back(p); ez[{b, p}] = true; if(i==0) s = b; if(i==1) t = b; } int dist[n]; for(int i = 0;i<n;i++) dist[i] = INF; dist[s] = 0; priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; pq.push({0, s}); while(!pq.empty()){ pair<int, int> curr = pq.top(); pq.pop(); if(curr.first != dist[curr.second]) continue; for(int j: adj[curr.second]){ int len = 0; for(int i = curr.second + j;i<n;i+=j){ len++; if(curr.first + len < dist[i]){ dist[i] = curr.first + len; pq.push({dist[i], i}); } if(ez[{i, j}]) goto second; } second: len = 0; for(int i = curr.second - j;i>=0;i-=j){ len++; if(curr.first + len < dist[i]){ dist[i] = curr.first + len; pq.push({dist[i], i}); } if(ez[{i, j}]) goto end; } end: } } cout<<dist[t]<<"\n"; }

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

skyscraper.cpp: In function 'int main()':
skyscraper.cpp:59:9: error: expected primary-expression before '}' token
         }
         ^