제출 #798467

#제출 시각아이디문제언어결과실행 시간메모리
798467winter0101밀림 점프 (APIO21_jumps)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define all(fl) fl.begin(),fl.end() #define pb push_back #define fi first #define se second #define for1(i,j,k) for(int i=j;i<=k;i++) #define for2(i,j,k) for(int i=j;i>=k;i--) #define for3(i,j,k,l) for(int i=j;i<=k;i+=l) #define lb lower_bound #define ub upper_bound #define sz(a) (int)a.size() #define pii pair<int,int> #define pli pair<long long,int> #define gcd __gcd #define lcm(x,y) x*y/__gcd(x,y) #define pil pair<int,long long> #define pll pair<long long,long long> #define eb emplace_back const int maxn=2e5+9; int h[maxn]; int n; pii a[maxn]; void buildstack(){ stack<int>t; t.push(n+1); for1(i,1,n){ while (!t.empty()&&h[t.top()]<h[i])t.pop(); a[i].fi=t.top(); t.push(i); } while (!t.empty())t.pop(); t.push(n+1); for2(i,n,1){ while (!t.empty()&&h[t.top()]<h[i])t.pop(); a[i].se=t.top(); t.push(i); } } vector<int>b[maxn]; int in[maxn],out[maxn],tme=0; void dfs(int u){ in[u]=++tme; for (auto v:b[u]){ dfs(v); } out[u]=tme; } void init(int N,vector<int>H){ n=N; for1(i,1,n)h[i]=H[i-1]; h[n+1]=n+1; buildstack(); int root=-1; for1(i,1,n){ if (a[i].fi==a[i].se&&a[i].se==n+1){ root=i; continue; } if (h[a[i].fi]<h[a[i].se]){ b[a[i].fi].pb(i); //cout<<a[i].fi<<" "<<i<<'\n'; } else { b[a[i].se].pb(i); //cout<<a[i].se<<" "<<i<<'\n'; } } dfs(root); } int minimum_jumps(int l1,int r1,int l2,int r2){ l1++,r1++,l2++,r2++; if (max(l1,l2)<=min(r1,r2))return 0; if (a[l2].fi!=n+1&&a[l2].fi>r1)return -1; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); //freopen("temp.INP","r",stdin); //freopen("temp.ANS","w",stdout); }

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

jumps.cpp: In function 'int minimum_jumps(int, int, int, int)':
jumps.cpp:75:1: warning: control reaches end of non-void function [-Wreturn-type]
   75 | }
      | ^
/usr/bin/ld: /tmp/ccxxLTC6.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc863PV8.o:jumps.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status