Submission #752113

# Submission time Handle Problem Language Result Execution time Memory
752113 2023-06-02T10:14:01 Z Muhammetali Cyberland (APIO23_cyberland) C++17
5 / 100
26 ms 5708 KB
#include "cyberland.h"
#include <bits/stdc++.h>
using namespace std;

using ll=long long;
using ld=long double;
using str=string;

using pi=pair<int,int>;
using pl=pair<ll,ll>;
using pd=pair<ld,ld>;
#define mp make_pair
#define f first
#define s second

template<class T>using V=vector<T>;
using vi=V<int>;
using vb=V<bool>;
using vl=V<ll>;
using vd=V<ld>;
using vs=V<str>;
using vpi=V<pi>;
using vpl=V<pl>;
using vpd=V<pd>;

#define sz(x) int((x).size())
#define all(x) begin(x),end(x)
#define rall(x) x.rbegin(), x.rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define pb push_back
#define eb emplace_back
#define ft front()
#define bk back()

#define lb lower_bound
#define ub upper_bound
template<class T> int lwb(V<T>&a,const T&b){return int(lb(all(a),b)-a.begin());}
template<class T> int upb(V<T>&a,const T&b){return int(ub(all(a),b)-a.begin());}

#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define F0R(i,a) FOR(i,0,a-1)
#define ROF(i,a,b) for(int i=(a);i>=(b);--i)
#define R0F(i,a) ROF(i,a-1,0)
#define rep(a) F0R(_,a)
#define each(a,x) for(auto& a:x)

const int MOD=1e9+7;//998244353;
const int MX=1e5+5;
const ll BIG=1e18;
const int dx[4]{1,0,-1,0}, dy[4]{0,1,0,-1};
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
template<class T> using pqg=priority_queue<T,vector<T>,greater<T>>;

constexpr int pct(int x){return __builtin_popcount(x);}
constexpr int bits(int x){return x==0?0:31-__builtin_clz(x);}
constexpr int p2(int x){return 1<<x;}

ll cdiv(ll a, ll b){return a/b+((a^b)>0&&a%b);}
ll fdiv(ll a, ll b){return a/b-((a^b)<0&&a%b);}

template<class T>bool ckmin(T&a,const T&b){return b<a?a=b,1:0;}
template<class T>bool ckmax(T&a,const T&b){return a<b?a=b,1:0;}

double solve(int n,int m,int k,int h,vi x,vi y,vi c,vi arr){
	double ans[n];
	ans[0]=0;
	for(int i=1;i<n;i++)ans[i]=INT_MAX;
	vpi adj[n];
	for(int i=0;i<m;i++){
		adj[x[i]].pb({y[i],c[i]});
		adj[y[i]].pb({x[i],c[i]});
	}
	pqg<pair<double,int>>p;
	p.push({0,0});
	while(!p.empty()){
		double sum=p.top().f;
		int k=p.top().s;
		p.pop();
		for(pi it:adj[k]){
			if(ans[it.f]>sum+it.s){
				ans[it.f]=sum+it.s;
				if(it.f!=0 && it.f!=h){
					if(arr[it.f]==0)ans[it.f]=0;
					else if(arr[it.f]==2)ans[it.f]/=2.0;
				}
				if(it.f!=h)p.push({ans[it.f],it.f});
			}
		}
	}
	if(ans[h]==INT_MAX)return -1;
	return ans[h];
}
# Verdict Execution time Memory Grader output
1 Correct 18 ms 468 KB Correct.
2 Correct 17 ms 372 KB Correct.
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 476 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 340 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 5708 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 488 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 464 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 468 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 340 KB Wrong Answer.
2 Halted 0 ms 0 KB -