제출 #981297

#제출 시각아이디문제언어결과실행 시간메모리
981297Faisal_Saqib밀림 점프 (APIO21_jumps)C++17
컴파일 에러
0 ms0 KiB
#include "jumps.h" #include <vector> #include <bits/stdc++.h> #include "stub.cpp" using namespace std; const int N=2002; int n; int dist[N]; vector<int> adj[N]; void init(int NP, std::vector<int> a) { n=NP; for(int i=0;i<n;i++) { int j=i; while(j>=0 and a[j]<=a[i]) j--; if((j>=0 and a[j]>a[i])) adj[i].push_back(j); j=i; while(j<n and a[j]<=a[i]) j++; if((j<n and a[j]>a[i])) adj[i].push_back(j); } } int minimum_jumps(int a, int b, int c, int d) { for(int j=0;j<=n;j++) dist[j]=2e9; priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq; for(int st=a;st<=b;st++) pq.push({dist[st]=0,st}); while(pq.size()) { auto it=pq.top(); if(c<=it.second and it.second<=d) return it.first; pq.pop(); if(dist[it.second]==it.first) for(auto dj:adj[it.second]) if(dist[dj]>(dist[it.second]+1)) { dist[dj]=dist[it.second]+1; pq.push({dist[dj],dj}); } } return -1; }

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

/usr/bin/ld: /tmp/ccJ93APo.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccwapZYp.o:jumps.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status