제출 #1008648

#제출 시각아이디문제언어결과실행 시간메모리
1008648aaaaaarroz추월 (IOI23_overtaking)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int l, n, m, x;
vector<ll> t; 
vector<ll> W;
vector<ll> s; 
vector<vector<pair<ll, ll>>> time(1009); 
vector<vector<ll>> dp(1009, vector<ll>(1009)); 
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;
    t.clear();
    W.clear();
    s.clear();
    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 arrival) {
    ll cur = arrival;
    for (int i = 1; i < m; i++) {
        int idx = lower_bound(time[i].begin(), time[i].end(), make_pair(cur, -1LL)) - time[i].begin() - 1;
        cur = max(cur + s[i - 1] * x, time[i][idx].second);
    }
    return cur;
}

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

overtaking.cpp:8:34: error: 'std::vector<std::vector<std::pair<long long int, long long int> > > time' redeclared as different kind of entity
    8 | vector<vector<pair<ll, ll>>> time(1009);
      |                                  ^
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: In function 'void init(int, int, std::vector<long long int>, std::vector<int>, int, int, std::vector<int>)':
overtaking.cpp:19:9: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   19 |   time[i].clear();
      |         ^
overtaking.cpp:19:11: 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'}
   19 |   time[i].clear();
      |           ^~~~~
overtaking.cpp:39:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   39 |         time[j].push_back(make_pair(-1, 0));
      |               ^
overtaking.cpp:39: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'}
   39 |         time[j].push_back(make_pair(-1, 0));
      |                 ^~~~~~~~~
overtaking.cpp:45:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   45 |             time[j].push_back(make_pair(x[i].first, max(mx, mx2)));
      |                   ^
overtaking.cpp:45: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'}
   45 |             time[j].push_back(make_pair(x[i].first, max(mx, mx2)));
      |                     ^~~~~~~~~
overtaking.cpp: In function 'll arrival_time(ll)':
overtaking.cpp:52:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   52 |         int idx = lower_bound(time[i].begin(), time[i].end(), make_pair(cur, -1LL)) - time[i].begin() - 1;
      |                                     ^
overtaking.cpp:52:39: error: request for member 'begin' in '*(time + ((sizetype)i))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   52 |         int idx = lower_bound(time[i].begin(), time[i].end(), make_pair(cur, -1LL)) - time[i].begin() - 1;
      |                                       ^~~~~
overtaking.cpp:52:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   52 |         int idx = lower_bound(time[i].begin(), time[i].end(), make_pair(cur, -1LL)) - time[i].begin() - 1;
      |                                                      ^
overtaking.cpp:52:56: error: request for member 'end' in '*(time + ((sizetype)i))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   52 |         int idx = lower_bound(time[i].begin(), time[i].end(), make_pair(cur, -1LL)) - time[i].begin() - 1;
      |                                                        ^~~
overtaking.cpp:52:93: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   52 |         int idx = lower_bound(time[i].begin(), time[i].end(), make_pair(cur, -1LL)) - time[i].begin() - 1;
      |                                                                                             ^
overtaking.cpp:52:95: error: request for member 'begin' in '*(time + ((sizetype)i))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   52 |         int idx = lower_bound(time[i].begin(), time[i].end(), make_pair(cur, -1LL)) - time[i].begin() - 1;
      |                                                                                               ^~~~~
overtaking.cpp:53:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   53 |         cur = max(cur + s[i - 1] * x, time[i][idx].second);
      |                                             ^
overtaking.cpp:53:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   53 |         cur = max(cur + s[i - 1] * x, time[i][idx].second);
      |                                                  ^
overtaking.cpp:53:52: error: request for member 'second' in '*(time + (((sizetype)i) + ((sizetype)idx)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
   53 |         cur = max(cur + s[i - 1] * x, time[i][idx].second);
      |                                                    ^~~~~~