# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1008619 | aaaaaarroz | Overtaking (IOI23_overtaking) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
typedef long long ll;
int l,n,x,m;vector<ll> t; vector<int> w, s;
void init(int L, int N, vector<ll>T, vector<int>W, int X,int M,vector<int>S){
l=L;
n=N;
t=T;
w=W;
x=X;
m=M;
s=S;
}
ll arrival_time(ll arrival){
vector<ll>ex(n+1);
vector<pair<ll,ll>>time(n+1);
for(int i=0;i<n;i++){
time[i]={t[i],i};
time[n]={arrival,n};
}
for(int i=1;i<m;i++){
for(int j=0;j<n;j++){
ex[j]=time[j].first+(w[j]*(s[i]-s[i-1]));
}
ex[n]=(time[n].first+(x*(s[i]-s[i-1])));
map<ll,vector<ll>>nv;
for(int j=0;j<=n;j++){
nv[time[j].first].push_back(j);
}
ll mx=0;
auto newtime=time;
for(auto [key, val]:nv){
for(auto v:val){
newtime[v]={v,max(mx,ex[v])};
}
for(auto v:val){
mx=max(mx,ex[v]);
}
}
sort(all(newtime));
for(int j=0;j<=n;j++){
time[j]={newtime[j].second,newtime[j].first};
}
}
return time[n].first;
}
Compilation message (stderr)
overtaking.cpp:3:13: error: 'vector' does not name a type 3 | int l,n,x,m;vector<ll> t; vector<int> w, s; | ^~~~~~ overtaking.cpp:3:27: error: 'vector' does not name a type 3 | int l,n,x,m;vector<ll> t; vector<int> w, s; | ^~~~~~ overtaking.cpp:4:25: error: 'vector' has not been declared 4 | void init(int L, int N, vector<ll>T, vector<int>W, int X,int M,vector<int>S){ | ^~~~~~ overtaking.cpp:4:31: error: expected ',' or '...' before '<' token 4 | void init(int L, int N, vector<ll>T, vector<int>W, int X,int M,vector<int>S){ | ^ overtaking.cpp: In function 'void init(int, int, int)': overtaking.cpp:7:2: error: 't' was not declared in this scope 7 | t=T; | ^ overtaking.cpp:7:4: error: 'T' was not declared in this scope 7 | t=T; | ^ overtaking.cpp:8:2: error: 'w' was not declared in this scope 8 | w=W; | ^ overtaking.cpp:8:4: error: 'W' was not declared in this scope 8 | w=W; | ^ overtaking.cpp:9:4: error: 'X' was not declared in this scope 9 | x=X; | ^ overtaking.cpp:10:4: error: 'M' was not declared in this scope 10 | m=M; | ^ overtaking.cpp:11:2: error: 's' was not declared in this scope 11 | s=S; | ^ overtaking.cpp:11:4: error: 'S' was not declared in this scope 11 | s=S; | ^ overtaking.cpp: In function 'll arrival_time(ll)': overtaking.cpp:14:2: error: 'vector' was not declared in this scope 14 | vector<ll>ex(n+1); | ^~~~~~ overtaking.cpp:14:2: note: suggested alternatives: In file included from /usr/include/c++/10/vector:67, from /usr/include/c++/10/functional:62, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from overtaking.cpp:1: /usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' 389 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ In file included from /usr/include/c++/10/functional:62, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from overtaking.cpp:1: /usr/include/c++/10/vector:86:13: note: 'std::pmr::vector' 86 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; | ^~~~~~ overtaking.cpp:14:11: error: expected primary-expression before '>' token 14 | vector<ll>ex(n+1); | ^ overtaking.cpp:14:12: error: 'ex' was not declared in this scope; did you mean 'x'? 14 | vector<ll>ex(n+1); | ^~ | x overtaking.cpp:15:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'? 15 | vector<pair<ll,ll>>time(n+1); | ^~~~ | std::pair In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from overtaking.cpp:1: /usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here 211 | struct pair | ^~~~ overtaking.cpp:15:16: error: expected primary-expression before ',' token 15 | vector<pair<ll,ll>>time(n+1); | ^ overtaking.cpp:15:19: error: expected primary-expression before '>>' token 15 | vector<pair<ll,ll>>time(n+1); | ^~ overtaking.cpp:15:27: error: invalid conversion from 'int' to 'time_t*' {aka 'long int*'} [-fpermissive] 15 | vector<pair<ll,ll>>time(n+1); | ~^~ | | | int In file included from /usr/include/c++/10/ctime:42, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:49, from overtaking.cpp:1: /usr/include/time.h:75:29: note: initializing argument 1 of 'time_t time(time_t*)' 75 | extern time_t time (time_t *__timer) __THROW; | ~~~~~~~~^~~~~~~ overtaking.cpp:17:9: warning: pointer to a function used in arithmetic [-Wpointer-arith] 17 | time[i]={t[i],i}; | ^ overtaking.cpp:17:12: error: 't' was not declared in this scope 17 | time[i]={t[i],i}; | ^ overtaking.cpp:17:10: error: assignment of read-only location '*(time + ((sizetype)i))' 17 | time[i]={t[i],i}; | ~~~~~~~^~~~~~~~~ overtaking.cpp:18:9: warning: pointer to a function used in arithmetic [-Wpointer-arith] 18 | time[n]={arrival,n}; | ^ overtaking.cpp:18:10: error: assignment of read-only location '*(time + ((sizetype)n))' 18 | time[n]={arrival,n}; | ~~~~~~~^~~~~~~~~~~~ overtaking.cpp:22:16: warning: pointer to a function used in arithmetic [-Wpointer-arith] 22 | ex[j]=time[j].first+(w[j]*(s[i]-s[i-1])); | ^ overtaking.cpp:22:18: error: request for member 'first' in '*(time + ((sizetype)j))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} 22 | ex[j]=time[j].first+(w[j]*(s[i]-s[i-1])); | ^~~~~ overtaking.cpp:22:25: error: 'w' was not declared in this scope 22 | ex[j]=time[j].first+(w[j]*(s[i]-s[i-1])); | ^ overtaking.cpp:22:31: error: 's' was not declared in this scope 22 | ex[j]=time[j].first+(w[j]*(s[i]-s[i-1])); | ^ overtaking.cpp:24:16: warning: pointer to a function used in arithmetic [-Wpointer-arith] 24 | ex[n]=(time[n].first+(x*(s[i]-s[i-1]))); | ^ overtaking.cpp:24:18: error: request for member 'first' in '*(time + ((sizetype)n))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} 24 | ex[n]=(time[n].first+(x*(s[i]-s[i-1]))); | ^~~~~ overtaking.cpp:24:28: error: 's' was not declared in this scope 24 | ex[n]=(time[n].first+(x*(s[i]-s[i-1]))); | ^ overtaking.cpp:25:3: error: 'map' was not declared in this scope 25 | map<ll,vector<ll>>nv; | ^~~ overtaking.cpp:25:3: note: suggested alternatives: In file included from /usr/include/c++/10/map:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from overtaking.cpp:1: /usr/include/c++/10/bits/stl_map.h:100:11: note: 'std::map' 100 | class map | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from overtaking.cpp:1: /usr/include/c++/10/map:78:13: note: 'std::pmr::map' 78 | using map | ^~~ overtaking.cpp:25:9: error: expected primary-expression before ',' token 25 | map<ll,vector<ll>>nv; | ^ overtaking.cpp:25:19: error: expected primary-expression before '>>' token 25 | map<ll,vector<ll>>nv; | ^~ overtaking.cpp:25:21: error: 'nv' was not declared in this scope; did you mean 'n'? 25 | map<ll,vector<ll>>nv; | ^~ | n overtaking.cpp:27:13: warning: pointer to a function used in arithmetic [-Wpointer-arith] 27 | nv[time[j].first].push_back(j); | ^ overtaking.cpp:27:15: error: request for member 'first' in '*(time + ((sizetype)j))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} 27 | nv[time[j].first].push_back(j); | ^~~~~ overtaking.cpp:33:19: error: 'max' was not declared in this scope; did you mean 'std::max'? 33 | newtime[v]={v,max(mx,ex[v])}; | ^~~ | std::max In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from overtaking.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ overtaking.cpp:36:8: error: 'max' was not declared in this scope; did you mean 'std::max'? 36 | mx=max(mx,ex[v]); | ^~~ | std::max In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from overtaking.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ overtaking.cpp:39:8: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'? 39 | sort(all(newtime)); | ^~~ | std::filesystem::perms::all In file included from /usr/include/c++/10/filesystem:44, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129, from overtaking.cpp:1: /usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here 148 | all = 0777, | ^~~ overtaking.cpp:39:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 39 | sort(all(newtime)); | ^~~~ | std::sort In file included from /usr/include/c++/10/algorithm:74, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from overtaking.cpp:1: /usr/include/c++/10/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ overtaking.cpp:41:10: warning: pointer to a function used in arithmetic [-Wpointer-arith] 41 | time[j]={newtime[j].second,newtime[j].first}; | ^ overtaking.cpp:41:22: warning: pointer to a function used in arithmetic [-Wpointer-arith] 41 | time[j]={newtime[j].second,newtime[j].first}; | ^ overtaking.cpp:41:24: error: request for member 'second' in '*(newtime + ((sizetype)j))', which is of non-class type 'long int(long int*) noexcept' 41 | time[j]={newtime[j].second,newtime[j].first}; | ^~~~~~ overtaking.cpp:41:40: warning: pointer to a function used in arithmetic [-Wpointer-arith] 41 | time[j]={newtime[j].second,newtime[j].first}; | ^ overtaking.cpp:41:42: error: request for member 'first' in '*(newtime + ((sizetype)j))', which is of non-class type 'long int(long int*) noexcept' 41 | time[j]={newtime[j].second,newtime[j].first}; | ^~~~~ overtaking.cpp:41:11: error: assignment of read-only location '*(time + ((sizetype)j))' 41 | time[j]={newtime[j].second,newtime[j].first}; | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ overtaking.cpp:44:15: warning: pointer to a function used in arithmetic [-Wpointer-arith] 44 | return time[n].first; | ^ overtaking.cpp:44:17: error: request for member 'first' in '*(time + ((sizetype)n))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} 44 | return time[n].first; | ^~~~~