Submission #843816

#TimeUsernameProblemLanguageResultExecution timeMemory
843816NemanjaSo2005Overtaking (IOI23_overtaking)C++17
Compilation error
0 ms0 KiB
#include "overtaking.h" #include<bits/stdc++.h> #define ll long long using namespace std; ll N,M,L,X,niz[1005]; struct bus{ ll w,krece,stize; bool operator < (const bus &a) const{ return krece<a.krece; } } bpp; bool cmp(bus a,bus b){ return a.w>b.w; } struct slog{ ll l,r,ans; }; set<bus> busevi[1005]; pair<set<bus>,vector<bus>> resi(vector<bus> V,ll d){ set<bus> A; vector<bus> B; if(V.size()==0) return {A,B}; bpp.krece=bpp.stize=-1; } ll arrival_time(ll Y); void init(int l,int n,vector<int> t,vector<int> w,int x,int m,vector<int> s){ N=n; L=l; M=m; X=x; for(int i=0;i<M;i++) niz[i]=s[i]; M--; vector<bus> V; for(int i=0;i<N;i++){ if(w[i]>=X) continue; bpp.w=w[i]; bpp.krece=t[i]; bpp.stize=t[i]; V.push_back(bpp); } for(int i=0;i+1<M;i++){ for(int i=0;i<V.size();i++) V[i].krece=V[i].stize; auto odg=resi(V,niz[i+1]-niz[i]); busevi[i]=odg.first; V=odg.second; } } ll arrival_time(ll Y){ if(S.size()==0) return Y+X*L; pp.l=Y; slog x; x.ans=-1; auto it=S.upper_bound(pp); if(it!=S.begin()) it--; if((*it).l<=Y and (*it).r>=Y) ans=(*it).ans; if(ans!=-1) return ans; return Y+X*L; } int main(){ int L, N, X, M, Q; assert(5 == scanf("%d %d %d %d %d", &L, &N, &X, &M, &Q)); std::vector<long long> T(N); for (int i = 0; i < N; i++) assert(1 == scanf("%lld", &T[i])); std::vector<int> W(N); for (int i = 0; i < N; i++) assert(1 == scanf("%d", &W[i])); std::vector<int> S(M); for (int i = 0; i < M; i++) assert(1 == scanf("%d", &S[i])); std::vector<long long> Y(Q); for (int i = 0; i < Q; i++) assert(1 == scanf("%lld", &Y[i])); fclose(stdin); init(L, N, T, W, X, M, S); std::vector<long long> res(Q); for (int i = 0; i < Q; i++) res[i] = arrival_time(Y[i]); for (int i = 0; i < Q; i++) printf("%lld\n", res[i]); fclose(stdout); return 0; } /// WIP

Compilation message (stderr)

overtaking.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, int, int, std::vector<int>)':
overtaking.cpp:46:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bus>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         for(int i=0;i<V.size();i++)
      |                     ~^~~~~~~~~
overtaking.cpp: In function 'long long int arrival_time(long long int)':
overtaking.cpp:54:8: error: 'S' was not declared in this scope
   54 |     if(S.size()==0)
      |        ^
overtaking.cpp:56:5: error: 'pp' was not declared in this scope; did you mean 'bpp'?
   56 |     pp.l=Y;
      |     ^~
      |     bpp
overtaking.cpp:59:13: error: 'S' was not declared in this scope
   59 |     auto it=S.upper_bound(pp);
      |             ^
overtaking.cpp:63:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   63 |         ans=(*it).ans;
      |         ^~~
      |         abs
overtaking.cpp:64:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   64 |     if(ans!=-1)
      |        ^~~
      |        abs
overtaking.cpp: In function 'std::pair<std::set<bus>, std::vector<bus> > resi(std::vector<bus>, long long int)':
overtaking.cpp:20:14: warning: control reaches end of non-void function [-Wreturn-type]
   20 |     set<bus> A;
      |              ^