Submission #536327

#TimeUsernameProblemLanguageResultExecution timeMemory
536327Icebear16Dungeons Game (IOI21_dungeons)C++17
0 / 100
7050 ms2097152 KiB
#include "dungeons.h" #include <bits/stdc++.h> struct edge{ int u,v; int weight; edge(int _u,int _v,int _w){ u=_u; v=_v; weight=_w; } }; std::vector<edge> adj[50000]; int ans; void dfs(int n, int z, std::vector<int> s, std::vector<int> p){ if(n==s.size()){ return; } ans=z; int y; for(int i=0;i<adj[n].size();i++){ if(ans>=s[n]){ y=adj[n][i].v; ans+=s[n]; }else{ y=adj[n][i].weight; ans+=p[n]; } dfs(y,ans,s,p); } } std::vector<int> g; std::vector<int> h; void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) { g=s; h=p; for(int i=0;i<w.size();i++){ adj[i].push_back(edge(i,w[i],l[i])); } return; } long long simulate(int x, int z) { dfs(x,z,g,h); return ans; }

Compilation message (stderr)

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