# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
961464 | 2024-04-12T06:52:20 Z | Warinchai | Dungeons Game (IOI21_dungeons) | C++17 | 291 ms | 231936 KB |
#include "dungeons.h" #include<bits/stdc++.h> using namespace std; int lift[26][400005]; long long mn[26][400005]; long long dis[26][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<=25;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=25;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 | 11 ms | 27484 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 27992 KB | Output is correct |
2 | Correct | 266 ms | 230368 KB | Output is correct |
3 | Correct | 254 ms | 230324 KB | Output is correct |
4 | Correct | 256 ms | 231868 KB | Output is correct |
5 | Correct | 266 ms | 231936 KB | Output is correct |
6 | Correct | 291 ms | 230192 KB | Output is correct |
7 | Correct | 264 ms | 228412 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 31936 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 31936 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 31936 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 27992 KB | Output is correct |
2 | Correct | 266 ms | 230368 KB | Output is correct |
3 | Correct | 254 ms | 230324 KB | Output is correct |
4 | Correct | 256 ms | 231868 KB | Output is correct |
5 | Correct | 266 ms | 231936 KB | Output is correct |
6 | Correct | 291 ms | 230192 KB | Output is correct |
7 | Correct | 264 ms | 228412 KB | Output is correct |
8 | Incorrect | 5 ms | 31936 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |