제출 #623941

#제출 시각아이디문제언어결과실행 시간메모리
623941Hanksburger던전 (IOI21_dungeons)C++17
25 / 100
198 ms242380 KiB
#include "dungeons.h" #include <bits/stdc++.h> using namespace std; pair<int, long long> par[6][25][50005]; vector<int> vec; int N; void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) { N=n; vec.push_back(0); for (int i=0; i<n; i++) vec.push_back(s[i]); sort(vec.begin(), vec.end()); vec.resize(unique(vec.begin(), vec.end())-vec.begin()); for (int i=0; i<vec.size(); i++) { int num=vec[i]; for (int j=0; j<n; j++) { if (num>=s[j]) par[i][0][j]={w[j], s[j]}; else par[i][0][j]={l[j], p[j]}; } par[i][0][n]={n, 0}; for (int j=1; j<=24; j++) { for (int k=0; k<=n; k++) { int u=par[i][j-1][k].first; par[i][j][k]={par[i][j-1][u].first, par[i][j-1][k].second+par[i][j-1][u].second}; } } } } long long simulate(int x, int Z) { long long z=Z; for (int i=0; i+2<=vec.size(); i++) { if (z>=vec[i+1]) continue; for (int j=24; j>=0; j--) { if (z+par[i][j][x].second<vec[i+1]) { z+=par[i][j][x].second; x=par[i][j][x].first; } } z+=par[i][0][x].second; x=par[i][0][x].first; } int ind=vec.size()-1; for (int i=24; i>=0; i--) { if (par[ind][i][x].first!=N) { z+=par[ind][i][x].second; x=par[ind][i][x].first; } } return z+par[ind][0][x].second; }

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

dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:15:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int i=0; i<vec.size(); i++)
      |                   ~^~~~~~~~~~~
dungeons.cpp: In function 'long long int simulate(int, int)':
dungeons.cpp:39:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for (int i=0; i+2<=vec.size(); 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...