제출 #437991

#제출 시각아이디문제언어결과실행 시간메모리
437991Apiram던전 (IOI21_dungeons)C++17
0 / 100
88 ms15524 KiB
#include "dungeons.h" #include <bits/stdc++.h> using namespace std; int nnn; vector<int>sss,ppp,www,lll; vector<int>winning_path(400001,INT_MAX); vector<int>adj[400001]; void gen(void); void init(int nn, vector<int> ss, vector<int> pp, vector<int> ww, vector<int> ll) { nnn=nn; sss=ss,ppp=pp,www=ww,lll=ll; for(int i = 0 ; i < nnn ; i++) { adj[www[i]].push_back(i); } gen(); } void gen(void) { //vector<bool>vis(nnn+1,false); //winning_path.resize(nnn+1); winning_path[nnn]=0; queue<pair<int,long long>>q; q.push({nnn,0}); long long cnt=0; while(!q.empty()) { pair<int,long long> u =q.front(); q.pop(); for(auto x:adj[u.first]){ if(winning_path[x]>u.second+1){ winning_path[x]=u.second+1; q.push({x,u.second+1}); }}}} long long simulate(int x, int zz) { long long z=zz; while(true) { if(x==nnn) return z; if(z >= sss[x] && winning_path[x]!=INT_MAX) { long long mul = sss[x]*winning_path[x]; return z+mul; } z+=ppp[x]; x=lll[x]; } }

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

dungeons.cpp: In function 'void gen()':
dungeons.cpp:25:15: warning: unused variable 'cnt' [-Wunused-variable]
   25 |     long long cnt=0;
      |               ^~~
#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...