Submission #536113

#TimeUsernameProblemLanguageResultExecution timeMemory
536113Icebear16Dungeons Game (IOI21_dungeons)C++17
0 / 100
137 ms33816 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[1000]; //std::vector<bool> visited(1000,false); int ans; void dfs(int n, int z, std::vector<int> s, std::vector<int> p){ 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]; } if(y!=s.size()){ 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: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:30:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   if(y!=s.size()){
      |      ~^~~~~~~~~~
dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:41:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |  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...