제출 #1008639

#제출 시각아이디문제언어결과실행 시간메모리
1008639aaaaaarroz추월 (IOI23_overtaking)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef ll ll; int l, n, m, x; vector<ll>t; vector<ll>W; vector<ll>s; vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>()); vector<vector<ll>>dp(1089,vector<ll>(1089)); void init(int L,int N,vector<ll>T,vector<int>w,int X,int M,vector<int>S) { l=L; n=N; m=M; x=X; for (int i=0;i<1009;i++) { time[i].clear(); } for (int i=0;i<N;i++) { if (w[i]>x) { W.push_back(w[i]); t.push_back(T[i]); } } for (int i=0;i<M-1;i++) { s.push_back(S[i+1]-S[i]); } n=t.size(); for (int i=0;i<N;i++) { dp[i][0]=t[i]; } for (int j=1;j<m;j++) { vector<pair<ll,ll>>x; for (int i=0;i<N;i++){ x.push_back(make_pair(dp[i][j-1],i)); } sort(x.begin(),x.end()); ll mx=0,mx2=0; time[j].push_back(make_pair(-1,0)); for (int i=0;i<N;i++) { if (i!=0&&x[i].first>x[i-1].first) { mx=max(mx,mx2); } int v=x[i].second; dp[v][j]=max(mx,dp[v][j-1]+W[v]*s[j-1]); mx2=max(mx2,dp[v][j]); time[j].push_back(make_pair(x[i].first,max(mx,mx2))); } } } ll arrival_time(ll arriva) { ll cur=arrival; for (int i=1;i<m;i++) { int idx=lower_bound(time[i].begin(),time[i].end(),{cur,-1})-time[i].begin()-1; cur=max(cur+s[i-1]*x,time[i][idx].second); } return cur; }

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

overtaking.cpp:3:9: error: 'll' does not name a type
    3 | typedef ll ll;
      |         ^~
overtaking.cpp:5:8: error: 'll' was not declared in this scope; did you mean 'l'?
    5 | vector<ll>t;
      |        ^~
      |        l
overtaking.cpp:5:10: error: template argument 1 is invalid
    5 | vector<ll>t;
      |          ^
overtaking.cpp:5:10: error: template argument 2 is invalid
overtaking.cpp:6:8: error: 'll' was not declared in this scope; did you mean 'l'?
    6 | vector<ll>W;
      |        ^~
      |        l
overtaking.cpp:6:10: error: template argument 1 is invalid
    6 | vector<ll>W;
      |          ^
overtaking.cpp:6:10: error: template argument 2 is invalid
overtaking.cpp:7:8: error: 'll' was not declared in this scope; did you mean 'l'?
    7 | vector<ll>s;
      |        ^~
      |        l
overtaking.cpp:7:10: error: template argument 1 is invalid
    7 | vector<ll>s;
      |          ^
overtaking.cpp:7:10: error: template argument 2 is invalid
overtaking.cpp:8:27: error: 'll' was not declared in this scope; did you mean 'l'?
    8 | vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>());
      |                           ^~
      |                           l
overtaking.cpp:8:31: error: 'll' was not declared in this scope; did you mean 'l'?
    8 | vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>());
      |                               ^~
      |                               l
overtaking.cpp:8:31: error: template argument 1 is invalid
overtaking.cpp:8:31: error: template argument 2 is invalid
overtaking.cpp:8:33: error: template argument 1 is invalid
    8 | vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>());
      |                                 ^~
overtaking.cpp:8:33: error: template argument 2 is invalid
overtaking.cpp:8:15: error: template argument 1 is invalid
    8 | vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>());
      |               ^~~~~~~~~~~~~~~~~~~~
overtaking.cpp:8:15: error: template argument 2 is invalid
overtaking.cpp:8:35: error: template argument 1 is invalid
    8 | vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>());
      |                                   ^~
overtaking.cpp:8:35: error: template argument 2 is invalid
overtaking.cpp:8:41: error: 'int time' redeclared as different kind of entity
    8 | vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>());
      |                                         ^
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:15: note: previous declaration 'time_t time(time_t*)'
   75 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
overtaking.cpp:8:59: error: 'll' was not declared in this scope; did you mean 'l'?
    8 | vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>());
      |                                                           ^~
      |                                                           l
overtaking.cpp:8:62: error: 'll' was not declared in this scope; did you mean 'l'?
    8 | vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>());
      |                                                              ^~
      |                                                              l
overtaking.cpp:8:64: error: template argument 1 is invalid
    8 | vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>());
      |                                                                ^
overtaking.cpp:8:64: error: template argument 2 is invalid
overtaking.cpp:8:66: error: template argument 1 is invalid
    8 | vector<vector<vector<pair<ll, ll>>>>time(1089,vector<pair<ll,ll>());
      |                                                                  ^
overtaking.cpp:8:66: error: template argument 2 is invalid
overtaking.cpp:9:15: error: 'll' was not declared in this scope; did you mean 'l'?
    9 | vector<vector<ll>>dp(1089,vector<ll>(1089));
      |               ^~
      |               l
overtaking.cpp:9:15: error: template argument 1 is invalid
overtaking.cpp:9:15: error: template argument 2 is invalid
overtaking.cpp:9:17: error: template argument 1 is invalid
    9 | vector<vector<ll>>dp(1089,vector<ll>(1089));
      |                 ^~
overtaking.cpp:9:17: error: template argument 2 is invalid
overtaking.cpp:9:34: error: 'll' was not declared in this scope; did you mean 'l'?
    9 | vector<vector<ll>>dp(1089,vector<ll>(1089));
      |                                  ^~
      |                                  l
overtaking.cpp:9:36: error: template argument 1 is invalid
    9 | vector<vector<ll>>dp(1089,vector<ll>(1089));
      |                                    ^
overtaking.cpp:9:36: error: template argument 2 is invalid
overtaking.cpp:9:43: error: expression list treated as compound expression in initializer [-fpermissive]
    9 | vector<vector<ll>>dp(1089,vector<ll>(1089));
      |                                           ^
overtaking.cpp:10:30: error: 'll' was not declared in this scope; did you mean 'l'?
   10 | void init(int L,int N,vector<ll>T,vector<int>w,int X,int M,vector<int>S) {
      |                              ^~
      |                              l
overtaking.cpp:10:32: error: template argument 1 is invalid
   10 | void init(int L,int N,vector<ll>T,vector<int>w,int X,int M,vector<int>S) {
      |                                ^
overtaking.cpp:10:32: error: template argument 2 is invalid
overtaking.cpp: In function 'void init(int, int, int, std::vector<int>, int, int, std::vector<int>)':
overtaking.cpp:16:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |        time[i].clear();
      |              ^
overtaking.cpp:16:16: error: request for member 'clear' in '*(time + ((sizetype)i))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   16 |        time[i].clear();
      |                ^~~~~
overtaking.cpp:20:15: error: request for member 'push_back' in 'W', which is of non-class type 'int'
   20 |             W.push_back(w[i]);
      |               ^~~~~~~~~
overtaking.cpp:21:15: error: request for member 'push_back' in 't', which is of non-class type 'int'
   21 |             t.push_back(T[i]);
      |               ^~~~~~~~~
overtaking.cpp:21:26: error: invalid types 'int[int]' for array subscript
   21 |             t.push_back(T[i]);
      |                          ^
overtaking.cpp:25:11: error: request for member 'push_back' in 's', which is of non-class type 'int'
   25 |         s.push_back(S[i+1]-S[i]);
      |           ^~~~~~~~~
overtaking.cpp:27:9: error: request for member 'size' in 't', which is of non-class type 'int'
   27 |     n=t.size();
      |         ^~~~
overtaking.cpp:29:11: error: invalid types 'int[int]' for array subscript
   29 |         dp[i][0]=t[i];
      |           ^
overtaking.cpp:29:19: error: invalid types 'int[int]' for array subscript
   29 |         dp[i][0]=t[i];
      |                   ^
overtaking.cpp:32:21: error: 'll' was not declared in this scope; did you mean 'l'?
   32 |         vector<pair<ll,ll>>x;
      |                     ^~
      |                     l
overtaking.cpp:32:24: error: template argument 1 is invalid
   32 |         vector<pair<ll,ll>>x;
      |                        ^~
overtaking.cpp:32:26: error: template argument 1 is invalid
   32 |         vector<pair<ll,ll>>x;
      |                          ^~
overtaking.cpp:32:26: error: template argument 2 is invalid
overtaking.cpp:34:15: error: request for member 'push_back' in 'x', which is of non-class type 'int'
   34 |             x.push_back(make_pair(dp[i][j-1],i));
      |               ^~~~~~~~~
overtaking.cpp:34:37: error: invalid types 'int[int]' for array subscript
   34 |             x.push_back(make_pair(dp[i][j-1],i));
      |                                     ^
overtaking.cpp:36:16: error: request for member 'begin' in 'x', which is of non-class type 'int'
   36 |         sort(x.begin(),x.end());
      |                ^~~~~
overtaking.cpp:36:26: error: request for member 'end' in 'x', which is of non-class type 'int'
   36 |         sort(x.begin(),x.end());
      |                          ^~~
overtaking.cpp:37:11: error: expected ';' before 'mx'
   37 |         ll mx=0,mx2=0;
      |           ^~~
      |           ;
overtaking.cpp:38:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |         time[j].push_back(make_pair(-1,0));
      |               ^
overtaking.cpp:38:17: error: request for member 'push_back' in '*(time + ((sizetype)j))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   38 |         time[j].push_back(make_pair(-1,0));
      |                 ^~~~~~~~~
overtaking.cpp:40:24: error: invalid types 'int[int]' for array subscript
   40 |             if (i!=0&&x[i].first>x[i-1].first) {
      |                        ^
overtaking.cpp:40:35: error: invalid types 'int[int]' for array subscript
   40 |             if (i!=0&&x[i].first>x[i-1].first) {
      |                                   ^
overtaking.cpp:41:17: error: 'mx' was not declared in this scope; did you mean 'x'?
   41 |                 mx=max(mx,mx2);
      |                 ^~
      |                 x
overtaking.cpp:41:27: error: 'mx2' was not declared in this scope
   41 |                 mx=max(mx,mx2);
      |                           ^~~
overtaking.cpp:43:20: error: invalid types 'int[int]' for array subscript
   43 |             int v=x[i].second;
      |                    ^
overtaking.cpp:44:15: error: invalid types 'int[int]' for array subscript
   44 |             dp[v][j]=max(mx,dp[v][j-1]+W[v]*s[j-1]);
      |               ^
overtaking.cpp:44:26: error: 'mx' was not declared in this scope; did you mean 'x'?
   44 |             dp[v][j]=max(mx,dp[v][j-1]+W[v]*s[j-1]);
      |                          ^~
      |                          x
overtaking.cpp:44:31: error: invalid types 'int[int]' for array subscript
   44 |             dp[v][j]=max(mx,dp[v][j-1]+W[v]*s[j-1]);
      |                               ^
overtaking.cpp:44:41: error: invalid types 'int[int]' for array subscript
   44 |             dp[v][j]=max(mx,dp[v][j-1]+W[v]*s[j-1]);
      |                                         ^
overtaking.cpp:44:46: error: invalid types 'int[int]' for array subscript
   44 |             dp[v][j]=max(mx,dp[v][j-1]+W[v]*s[j-1]);
      |                                              ^
overtaking.cpp:45:13: error: 'mx2' was not declared in this scope
   45 |             mx2=max(mx2,dp[v][j]);
      |             ^~~
overtaking.cpp:45:27: error: invalid types 'int[int]' for array subscript
   45 |             mx2=max(mx2,dp[v][j]);
      |                           ^
overtaking.cpp:46:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |             time[j].push_back(make_pair(x[i].first,max(mx,mx2)));
      |                   ^
overtaking.cpp:46:21: error: request for member 'push_back' in '*(time + ((sizetype)j))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   46 |             time[j].push_back(make_pair(x[i].first,max(mx,mx2)));
      |                     ^~~~~~~~~
overtaking.cpp:46:42: error: invalid types 'int[int]' for array subscript
   46 |             time[j].push_back(make_pair(x[i].first,max(mx,mx2)));
      |                                          ^
overtaking.cpp: At global scope:
overtaking.cpp:50:1: error: 'll' does not name a type; did you mean 'l'?
   50 | ll arrival_time(ll arriva) {
      | ^~
      | l