제출 #444091

#제출 시각아이디문제언어결과실행 시간메모리
444091leinad2던전 (IOI21_dungeons)C++17
0 / 100
7021 ms15500 KiB
#include "dungeons.h" #include<bits/stdc++.h> using namespace std; int N, i, j, sparse2[400010][20]; long long A[400010], sparse[400010][20]; vector<int>S, P, W, L; void init(int n, vector<int>s, vector<int>p, vector<int>w, vector<int>l) { N=n;S=s;P=p;W=w;L=l;W.push_back(N); for(i=n-1;i>=0;i--)A[i]=A[W[i]]+S[i]; for(i=n-1;i>=0;i--)A[i]; A[n]=9e18; for(i=0;i++<n;)sparse[i][0]=A[W[i]]+S[W[i]],sparse2[i][0]=W[i]; for(j=1;j<20;j++)for(i=0;i++<n;)sparse[i][j]=max(sparse[i][j-1], sparse[sparse2[i][j-1]][j-1]),sparse2[i][j]=sparse2[sparse2[i][j-1]][j-1]; } long long simulate(int x, int z) { while(x<N) { if(z<S[x])goto w; for(j=19;j>=0;j--) { if(sparse[x][j]>z+A[x])continue; z+=(A[x]-A[sparse2[x][j]]);x=sparse2[x][j]; } w:; if(z<S[x]) { z+=P[x]; x=L[x]; } else { z+=S[x]; x=S[x]; } } return z; }

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

dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:11:27: warning: statement has no effect [-Wunused-value]
   11 |     for(i=n-1;i>=0;i--)A[i];
      |                        ~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...