제출 #848743

#제출 시각아이디문제언어결과실행 시간메모리
8487437as__7추월 (IOI23_overtaking)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
const int N = 2e5 + 1;
#define int long long
int xox0;
int arrival_time(int x) {
    return xox0 = x;
}
void init(int L, int n, int T[], int W[], int X, int m, int s[]) {
    vector<pair<int, int>>t(n + 1); vector<int> d(m);
    for (int i = 0; i < n; i++) {
        t[i].first = T[i];
    }
    for (int i = 0; i < n; i++) {
        t[i].second = W[i];
    }
    for (int i = 0; i < m; i++) {
        d[i] = s[i];
    }
    t[n].second = X;
    t[n].first = xox0;
    pair<int, int>p = t[n];
    int prv = 0;
    for (int i = 0; i < m; i++) {
        sort(all(t));
        int mx = 0;
        for (int j = 0; j <= n; j++) {
            int x = (d[i] - prv) * t[j].second + t[j].first;
            mx = max(mx, x);
            if (p == t[j]) {
                p = { mx,t[j].second };
            }
            t[j] = { mx,t[j].second };
        }
        prv = d[i];
    }
    return  p.first;
}

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

overtaking.cpp: In function 'void init(long long int, long long int, long long int*, long long int*, long long int, long long int, long long int*)':
overtaking.cpp:38:15: error: return-statement with a value, in function returning 'void' [-fpermissive]
   38 |     return  p.first;
      |             ~~^~~~~