# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
961465 | 2024-04-12T06:54:45 Z | Warinchai | Dungeons Game (IOI21_dungeons) | C++17 | 238 ms | 176448 KB |
#include "dungeons.h" #include<bits/stdc++.h> using namespace std; int lift[20][400005]; long long mn[20][400005]; long long dis[20][400005]; long long inf=1e18+7; int N; vector<int>W; vector<int>S; vector<int>L; vector<int>P; void init(int n,vector<int> s,vector<int> p,vector<int> w,vector<int> l) { N=n; S=s; W=w; L=l; P=p; for(int j=0;j<n;j++){ lift[0][j]=w[j],mn[0][j]=s[j],dis[0][j]=p[j]; } lift[0][n]=n; mn[0][n]=inf; for(int j=1;j<=19;j++){ for(int k=0;k<=n;k++){ lift[j][k]=lift[j-1][lift[j-1][k]]; dis[j][k]=dis[j-1][k]+dis[j-1][lift[j-1][k]]; mn[j][k]=max(mn[j-1][k],mn[j-1][lift[j-1][k]]-dis[j-1][k]); } } /*for(int i=0;i<=n;i++){ for(int j=0;j<3;j++){ cerr<<i<<" "<<j<<":"<<dis[j][i]<<" "<<lift[j][i]<<"\n"; } cerr<<"\n"; }*/ //cerr<<"work\n"; return; } long long simulate(int x, int z) { //cerr<<"work\n"; long long c=0,lv=0; long long pow=z; /*while(x>(1<<c)){ lv=c; c++; }*/ //cerr<<x<<"\n"; //cerr<<lv<<"\n"; while(1){ //cerr<<"new:"<<x<<" "<<pow<<"\n"; for(int i=19;i>=0;i--){ //cerr<<i<<" "<<lv<<" "<<x<<"\n"; if(pow>=mn[i][x])pow+=dis[i][x],x=lift[i][x]/*,cerr<<x<<" "<<pow<<"\n"*/; } //cerr<<x<<" "<<pow<<"\n\n"; if(x==N)break; pow+=P[x]; x=L[x]; } ///cerr<<x<<" "<<pow<<"\n"; //cerr<<"\n"; return pow; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 23128 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 23644 KB | Output is correct |
2 | Correct | 224 ms | 176444 KB | Output is correct |
3 | Correct | 227 ms | 176444 KB | Output is correct |
4 | Correct | 238 ms | 176440 KB | Output is correct |
5 | Correct | 236 ms | 176448 KB | Output is correct |
6 | Correct | 233 ms | 176368 KB | Output is correct |
7 | Correct | 220 ms | 176436 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 23640 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 23640 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 23640 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 23644 KB | Output is correct |
2 | Correct | 224 ms | 176444 KB | Output is correct |
3 | Correct | 227 ms | 176444 KB | Output is correct |
4 | Correct | 238 ms | 176440 KB | Output is correct |
5 | Correct | 236 ms | 176448 KB | Output is correct |
6 | Correct | 233 ms | 176368 KB | Output is correct |
7 | Correct | 220 ms | 176436 KB | Output is correct |
8 | Incorrect | 4 ms | 23640 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |