Submission #1008620

#TimeUsernameProblemLanguageResultExecution timeMemory
1008620aaaaaarroz추월 (IOI23_overtaking)C++17
Compilation error
0 ms0 KiB
#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:4:1: error: 'vector' does not name a type
    4 | vector<ll>t;
      | ^~~~~~
overtaking.cpp:5:1: error: 'vector' does not name a type
    5 | vector<int>w,s;
      | ^~~~~~
overtaking.cpp:6:25: error: 'vector' has not been declared
    6 | void init(int L, int N, vector<ll>T, vector<int>W, int X,int M,vector<int>S){
      |                         ^~~~~~
overtaking.cpp:6:31: error: expected ',' or '...' before '<' token
    6 | 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:9:2: error: 't' was not declared in this scope
    9 |  t=T;
      |  ^
overtaking.cpp:9:4: error: 'T' was not declared in this scope
    9 |  t=T;
      |    ^
overtaking.cpp:10:2: error: 'w' was not declared in this scope
   10 |  w=W;
      |  ^
overtaking.cpp:10:4: error: 'W' was not declared in this scope
   10 |  w=W;
      |    ^
overtaking.cpp:11:4: error: 'X' was not declared in this scope
   11 |  x=X;
      |    ^
overtaking.cpp:12:4: error: 'M' was not declared in this scope
   12 |  m=M;
      |    ^
overtaking.cpp:13:2: error: 's' was not declared in this scope
   13 |  s=S;
      |  ^
overtaking.cpp:13:4: error: 'S' was not declared in this scope
   13 |  s=S;
      |    ^
overtaking.cpp: In function 'll arrival_time(ll)':
overtaking.cpp:16:2: error: 'vector' was not declared in this scope
   16 |  vector<ll>ex(n+1);
      |  ^~~~~~
overtaking.cpp:16: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:16:11: error: expected primary-expression before '>' token
   16 |  vector<ll>ex(n+1);
      |           ^
overtaking.cpp:16:12: error: 'ex' was not declared in this scope; did you mean 'x'?
   16 |  vector<ll>ex(n+1);
      |            ^~
      |            x
overtaking.cpp:17:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   17 |  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:17:16: error: expected primary-expression before ',' token
   17 |  vector<pair<ll,ll>>time(n+1);
      |                ^
overtaking.cpp:17:19: error: expected primary-expression before '>>' token
   17 |  vector<pair<ll,ll>>time(n+1);
      |                   ^~
overtaking.cpp:17:27: error: invalid conversion from 'int' to 'time_t*' {aka 'long int*'} [-fpermissive]
   17 |  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:19:9: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   19 |   time[i]={t[i],i};
      |         ^
overtaking.cpp:19:12: error: 't' was not declared in this scope
   19 |   time[i]={t[i],i};
      |            ^
overtaking.cpp:19:10: error: assignment of read-only location '*(time + ((sizetype)i))'
   19 |   time[i]={t[i],i};
      |   ~~~~~~~^~~~~~~~~
overtaking.cpp:20:9: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   20 |   time[n]={arrival,n};
      |         ^
overtaking.cpp:20:10: error: assignment of read-only location '*(time + ((sizetype)n))'
   20 |   time[n]={arrival,n};
      |   ~~~~~~~^~~~~~~~~~~~
overtaking.cpp:24:16: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |    ex[j]=time[j].first+(w[j]*(s[i]-s[i-1]));
      |                ^
overtaking.cpp:24: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'}
   24 |    ex[j]=time[j].first+(w[j]*(s[i]-s[i-1]));
      |                  ^~~~~
overtaking.cpp:24:25: error: 'w' was not declared in this scope
   24 |    ex[j]=time[j].first+(w[j]*(s[i]-s[i-1]));
      |                         ^
overtaking.cpp:24:31: error: 's' was not declared in this scope
   24 |    ex[j]=time[j].first+(w[j]*(s[i]-s[i-1]));
      |                               ^
overtaking.cpp:26:16: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   26 |   ex[n]=(time[n].first+(x*(s[i]-s[i-1])));
      |                ^
overtaking.cpp:26: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'}
   26 |   ex[n]=(time[n].first+(x*(s[i]-s[i-1])));
      |                  ^~~~~
overtaking.cpp:26:28: error: 's' was not declared in this scope
   26 |   ex[n]=(time[n].first+(x*(s[i]-s[i-1])));
      |                            ^
overtaking.cpp:27:3: error: 'map' was not declared in this scope
   27 |   map<ll,vector<ll>>nv;
      |   ^~~
overtaking.cpp:27: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:27:9: error: expected primary-expression before ',' token
   27 |   map<ll,vector<ll>>nv;
      |         ^
overtaking.cpp:27:19: error: expected primary-expression before '>>' token
   27 |   map<ll,vector<ll>>nv;
      |                   ^~
overtaking.cpp:27:21: error: 'nv' was not declared in this scope; did you mean 'n'?
   27 |   map<ll,vector<ll>>nv;
      |                     ^~
      |                     n
overtaking.cpp:29:13: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   29 |    nv[time[j].first].push_back(j);
      |             ^
overtaking.cpp:29: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'}
   29 |    nv[time[j].first].push_back(j);
      |               ^~~~~
overtaking.cpp:35:19: error: 'max' was not declared in this scope; did you mean 'std::max'?
   35 |     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:38:8: error: 'max' was not declared in this scope; did you mean 'std::max'?
   38 |     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:41:8: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   41 |   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:41:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   41 |   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:43:10: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   43 |    time[j]={newtime[j].second,newtime[j].first};
      |          ^
overtaking.cpp:43:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   43 |    time[j]={newtime[j].second,newtime[j].first};
      |                      ^
overtaking.cpp:43:24: error: request for member 'second' in '*(newtime + ((sizetype)j))', which is of non-class type 'long int(long int*) noexcept'
   43 |    time[j]={newtime[j].second,newtime[j].first};
      |                        ^~~~~~
overtaking.cpp:43:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   43 |    time[j]={newtime[j].second,newtime[j].first};
      |                                        ^
overtaking.cpp:43:42: error: request for member 'first' in '*(newtime + ((sizetype)j))', which is of non-class type 'long int(long int*) noexcept'
   43 |    time[j]={newtime[j].second,newtime[j].first};
      |                                          ^~~~~
overtaking.cpp:43:11: error: assignment of read-only location '*(time + ((sizetype)j))'
   43 |    time[j]={newtime[j].second,newtime[j].first};
      |    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
overtaking.cpp:46:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |  return time[n].first;
      |               ^
overtaking.cpp:46: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'}
   46 |  return time[n].first;
      |                 ^~~~~