Submission #934025

#TimeUsernameProblemLanguageResultExecution timeMemory
934025alo_54Bridges (APIO19_bridges)C++14
13 / 100
3099 ms40824 KiB
#include <bits/stdc++.h> using namespace std; int n, m; int cont = 0; int pesos[100005]; bool vis[500004]; struct Puente { int v, idx; }; vector <Puente> ady[1500004]; void ask(int curr, int peso) { //vis[curr] = true; //cout<<curr<<".size "<< ady[curr].size()<<endl; for (int i = 0; i < ady[curr].size(); i++) { //cout<<"ask "<<ady[curr][i].v<<" "; if (vis[ady[curr][i].v] == false and pesos[ady[curr][i].idx] >= peso) { vis[ady[curr][i].v] = true; //// cout<<"se visita "<<ady[curr][i].v<<endl; // cout<<"ok"<<endl; cont ++; //cout<<"de "<<curr<<" se puede llegar a "<<ady[curr][i].v<<endl; ask(ady[curr][i].v, peso); } /*else { if (vis[ady[curr][i].v] == true) { cout<<ady[curr][i].v<<" ya visitado"<<endl; }else { cout<<ady[curr][i].v<<" no resiste"<<endl;; } }*/ } return; } int main() { cin>>n>>m; Puente nuevo1, nuevo2; int s1, s2, w; for (int i = 1; i <= m; i++) { cin>>s1>>s2>>w; nuevo1.v = s1; nuevo1.idx = i; nuevo2.v = s2; nuevo2.idx = i; ady[s1].push_back(nuevo2); ady[s2].push_back(nuevo1); pesos[i] = w; } int q; cin>>q; int t, a, b; for (int i = 0; i < q; i++) { cin>>t; if (t == 1) { cin>>a>>b; pesos[a] = b; }else { cin>>a>>b; fill(vis, vis + n+3, false); vis[a] = true; cont = 1; ask(a, b); cout<<cont<<"\n"; } } }

Compilation message (stderr)

bridges.cpp: In function 'void ask(int, int)':
bridges.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Puente>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i = 0; i < ady[curr].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...