Submission #389058

# Submission time Handle Problem Language Result Execution time Memory
389058 2021-04-13T14:56:30 Z PedroBigMan Escape Route (JOI21_escape_route) C++17
Compilation error
0 ms 0 KB
#include "escape_route.h"
/*
Author of all code: Pedro BIGMAN Dias
Last edit: 15/02/2021
*/
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 5000000000000000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=1000000007LL;

ll S; vector<vector<ll> > C;

template<class A=ll> 
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}

class WG //everything works for weighted directed graphs except dynamic graph
{
    public:
    ll N; vector<vector<pl> > adj;
    vector<bool> pr; 
    
    WG(vector<vector<pl> > ad)
    {
        adj=ad; N=adj.size();
        REP(i,0,N) {pr.pb(false);}
    }
    
    void Reset()
    {
        REP(i,0,N) {pr[i]=false;}
    }
    
	void Staircase(ll s) 
	{
		priority_queue<pair<ll,vector<ll> > > q; //elements are {max time needed to leave s, {a,b}} where a is already optimized
		ll curtime = S;
		pair<ll,vector<ll> > cur;
		REP(i,0,adj[s].size())
		{
			q.push({C[s][i],{s,adj[s][i].ff,adj[s][i].ss}});
		}
		while(q.size()>0)
		{
			cur=q.top(); q.pop();
			if(cur.ff<curtime)
			{
				
			}
			else
			{
				ll node = cur.ss[1];
			}
		}
	}
};

vector<ll> calculate_necessary_time(int N, int M, ll s, int Q, vector<int> A, vector<int> B,vector<ll> L,vector<ll> c,vector<int> U,vector<int> V,vector<ll> T) 
{
	S=s; 
	vector<vector<pl> > adj; vector<pl> xx; vector<ll> xxx; REP(i,0,N) {adj.pb(xx); C.pb(xxx);}
	REP(i,0,M) {c[i]=c[i]-L[i];}
	REP(i,0,M)
	{
		adj[A[i]].pb(mp(B[i],L[i])); adj[B[i]].pb(mp(A[i],L[i]));
		C[A[i]].pb(c[i]); C[B[i]].pb(c[i]);
	}
	WG G(adj);
	vector<ll> ans; 
	REP(q,0,Q)
	{
		G.Reset();
		vector<ll> d = G.Dijkstra(U[q],T[q]);
		ans.pb(d[V[q]]-T[q]);
	}
	return ans;
}

Compilation message

escape_route.cpp: In member function 'void WG::Staircase(ll)':
escape_route.cpp:79:8: warning: unused variable 'node' [-Wunused-variable]
   79 |     ll node = cur.ss[1];
      |        ^~~~
escape_route.cpp: In function 'std::vector<long long int> calculate_necessary_time(int, int, ll, int, std::vector<int>, std::vector<int>, std::vector<long long int>, std::vector<long long int>, std::vector<int>, std::vector<int>, std::vector<long long int>)':
escape_route.cpp:100:20: error: 'class WG' has no member named 'Dijkstra'
  100 |   vector<ll> d = G.Dijkstra(U[q],T[q]);
      |                    ^~~~~~~~