답안 #896246

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
896246 2024-01-01T05:15:10 Z Sir_Ahmed_Imran 던전 (IOI21_dungeons) C++17
50 / 100
7000 ms 379136 KB
                              ///~~~LOTA~~~///
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long 
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define N 400001
ll n;
ll l[N][19];
ll w[N][19];
ll sl[N][19];
ll sw[N][19];
ll rw[N][19];
ll rl[N][19];
void init(int m,vector<int> s,vector<int> p,vector<int> W,vector<int> L){
    n=m;
    w[n][0]=n;
    rw[n][0]=1e17;
    for(int i=0;i<n;i++){
        l[i][0]=L[i];
        w[i][0]=W[i];
        sl[i][0]=p[i];
        sw[i][0]=s[i];
        rl[i][0]=s[i]+p[i];
        rw[i][0]=s[i]+s[i];
    }
    for(int j=0;j<18;j++){
        for(int i=0;i<=n;i++){
            l[i][j+1]=l[l[i][j]][j];
            w[i][j+1]=w[w[i][j]][j];
            sl[i][j+1]=sl[i][j]+sl[l[i][j]][j];
            sw[i][j+1]=sw[i][j]+sw[w[i][j]][j];
            rl[i][j+1]=min(rl[l[i][j]][j],rl[i][j]+sl[l[i][j]][j]);
            rw[i][j+1]=max(rw[w[i][j]][j],rw[i][j]+sw[w[i][j]][j]);
        }
    }
}
ll simulate(int x,int z){
    int t=0;
    ll p=x;
    ll q=z;
    while(p!=n){
        if(t==1){
            for(int j=18;j>=0;j--){
                if(rw[p][j]<=sw[p][j]+q){
                    q+=sw[p][j];
                    p=w[p][j];
                }
            }
        }
        else{
            for(int j=18;j>=0;j--){
                if(rl[p][j]>sl[p][j]+q){
                    q+=sl[p][j];
                    p=l[p][j];
                }
            }
        }
        t=(t+1)%2;
    }
    return q;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 10584 KB Output is correct
2 Correct 1 ms 10588 KB Output is correct
3 Correct 4 ms 23248 KB Output is correct
4 Correct 60 ms 61532 KB Output is correct
5 Correct 4 ms 23132 KB Output is correct
6 Correct 53 ms 61684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 10840 KB Output is correct
2 Correct 556 ms 370688 KB Output is correct
3 Correct 494 ms 377520 KB Output is correct
4 Correct 486 ms 379060 KB Output is correct
5 Correct 479 ms 379136 KB Output is correct
6 Correct 503 ms 377428 KB Output is correct
7 Correct 452 ms 375716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 10844 KB Output is correct
2 Correct 81 ms 62432 KB Output is correct
3 Correct 92 ms 62524 KB Output is correct
4 Correct 88 ms 63420 KB Output is correct
5 Correct 86 ms 63472 KB Output is correct
6 Correct 76 ms 63488 KB Output is correct
7 Correct 123 ms 63732 KB Output is correct
8 Correct 85 ms 63324 KB Output is correct
9 Correct 80 ms 63476 KB Output is correct
10 Correct 84 ms 63300 KB Output is correct
11 Correct 90 ms 63568 KB Output is correct
12 Correct 1535 ms 63984 KB Output is correct
13 Correct 1623 ms 63568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 10844 KB Output is correct
2 Correct 81 ms 62432 KB Output is correct
3 Correct 92 ms 62524 KB Output is correct
4 Correct 88 ms 63420 KB Output is correct
5 Correct 86 ms 63472 KB Output is correct
6 Correct 76 ms 63488 KB Output is correct
7 Correct 123 ms 63732 KB Output is correct
8 Correct 85 ms 63324 KB Output is correct
9 Correct 80 ms 63476 KB Output is correct
10 Correct 84 ms 63300 KB Output is correct
11 Correct 90 ms 63568 KB Output is correct
12 Correct 1535 ms 63984 KB Output is correct
13 Correct 1623 ms 63568 KB Output is correct
14 Correct 2 ms 10840 KB Output is correct
15 Correct 158 ms 63844 KB Output is correct
16 Correct 86 ms 64064 KB Output is correct
17 Correct 91 ms 63480 KB Output is correct
18 Correct 91 ms 63568 KB Output is correct
19 Correct 80 ms 63728 KB Output is correct
20 Correct 106 ms 63468 KB Output is correct
21 Correct 89 ms 63572 KB Output is correct
22 Execution timed out 7026 ms 63812 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 10844 KB Output is correct
2 Correct 81 ms 62432 KB Output is correct
3 Correct 92 ms 62524 KB Output is correct
4 Correct 88 ms 63420 KB Output is correct
5 Correct 86 ms 63472 KB Output is correct
6 Correct 76 ms 63488 KB Output is correct
7 Correct 123 ms 63732 KB Output is correct
8 Correct 85 ms 63324 KB Output is correct
9 Correct 80 ms 63476 KB Output is correct
10 Correct 84 ms 63300 KB Output is correct
11 Correct 90 ms 63568 KB Output is correct
12 Correct 1535 ms 63984 KB Output is correct
13 Correct 1623 ms 63568 KB Output is correct
14 Correct 2 ms 10840 KB Output is correct
15 Correct 158 ms 63844 KB Output is correct
16 Correct 86 ms 64064 KB Output is correct
17 Correct 91 ms 63480 KB Output is correct
18 Correct 91 ms 63568 KB Output is correct
19 Correct 80 ms 63728 KB Output is correct
20 Correct 106 ms 63468 KB Output is correct
21 Correct 89 ms 63572 KB Output is correct
22 Execution timed out 7026 ms 63812 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 10840 KB Output is correct
2 Correct 556 ms 370688 KB Output is correct
3 Correct 494 ms 377520 KB Output is correct
4 Correct 486 ms 379060 KB Output is correct
5 Correct 479 ms 379136 KB Output is correct
6 Correct 503 ms 377428 KB Output is correct
7 Correct 452 ms 375716 KB Output is correct
8 Correct 2 ms 10844 KB Output is correct
9 Correct 81 ms 62432 KB Output is correct
10 Correct 92 ms 62524 KB Output is correct
11 Correct 88 ms 63420 KB Output is correct
12 Correct 86 ms 63472 KB Output is correct
13 Correct 76 ms 63488 KB Output is correct
14 Correct 123 ms 63732 KB Output is correct
15 Correct 85 ms 63324 KB Output is correct
16 Correct 80 ms 63476 KB Output is correct
17 Correct 84 ms 63300 KB Output is correct
18 Correct 90 ms 63568 KB Output is correct
19 Correct 1535 ms 63984 KB Output is correct
20 Correct 1623 ms 63568 KB Output is correct
21 Correct 2 ms 10840 KB Output is correct
22 Correct 158 ms 63844 KB Output is correct
23 Correct 86 ms 64064 KB Output is correct
24 Correct 91 ms 63480 KB Output is correct
25 Correct 91 ms 63568 KB Output is correct
26 Correct 80 ms 63728 KB Output is correct
27 Correct 106 ms 63468 KB Output is correct
28 Correct 89 ms 63572 KB Output is correct
29 Execution timed out 7026 ms 63812 KB Time limit exceeded
30 Halted 0 ms 0 KB -