| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 209762 | Alexa2001 | Solar Storm (NOI20_solarstorm) | C++17 | 221 ms | 113248 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int Nmax = 1e6 + 5, lg = 20;
// 15 : 38
int go[lg+1][Nmax], n, S, deploy[Nmax];
ll coef[Nmax], d[Nmax], K;
const int bsize = 1 << 18;
char buffer[bsize+2]; int cursor;
static inline void init_read()
{
    fread(buffer, 1, bsize, stdin), cursor = 0;
}
template<typename T>
void read(T &x)
{
    x = 0;
    while(!isdigit(buffer[cursor]))
    {
        ++cursor;
        if(cursor == bsize) init_read();
    }
    while(isdigit(buffer[cursor]))
    {
        x = x * 10 + buffer[cursor] - '0';
        ++cursor;
        if(cursor == bsize) init_read();
    }
}
int main()
{
   // freopen("input", "r", stdin);
    cin.sync_with_stdio(false); cin.tie(0);
    init_read();
    read(n); read(S); read(K);
    int i;
    for(i=2; i<=n; ++i)
    {
        read(d[i]);
        d[i] += d[i-1];
    }
    for(i=1; i<=n; ++i) read(coef[i]), coef[i] += coef[i-1];
    d[n+1] = 1e18;
    int j, k;
    j = 1; k = 2;
    for(i=1; i<=n; ++i)
    {
        while(d[j+1] - d[i] <= K) ++j;
        while(d[k] - d[j] <= K) ++k;
        go[0][i] = k;
        deploy[i] = j;
    }
    go[0][n+1] = n+1;
    for(j=1; j<=lg; ++j)
        for(i=1; i<=n+1; ++i)
            go[j][i] = go[j-1][go[j-1][i]];
    ll ans = -1;
    int start, finish;
    for(i=1; i<=n; ++i)
    {
        int to = i;
        for(j=0; j<=lg; ++j)
            if(S & (1<<j))
                to = go[j][to];
        ll curr = coef[to-1] - coef[i-1];
        if(curr > ans)
            ans = curr, start = i, finish = to - 1;
    }
    vector<int> Ans;
    while(start <= finish)
    {
        Ans.push_back(deploy[start]);
        start = go[0][start];
    }
    cout << Ans.size() << '\n';
    for(auto it : Ans) cout << it << ' ';
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
