Submission #1092464

#TimeUsernameProblemLanguageResultExecution timeMemory
1092464BABY_GANGSTERConstruction Project 2 (JOI24_ho_t2)C++14
53 / 100
132 ms27720 KiB
#pragma GCC optimize("Ofast,unroll-loops") #include<bits/stdc++.h> #define int long long //#define ll long long #define down cout<<'\n'; #define debug cout<<" cucuucucuuu",down #define NHP ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); #define modwwe int t;cin>>t; while(t--) #define bit(i,j) (i>>j&1) #define sobit(a) __builtin_popcountll(a) #define task "test" #define fin(x) freopen(x".inp","r",stdin) #define fou(x) freopen(x".out","w",stdout) #define pb push_back #define checktime cerr << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms"; using namespace std; #define getchar_unlocked getchar inline int scan() { char c = getchar_unlocked(); int x = 0; while (c < '0' || c > '9') { c = getchar_unlocked(); } while (c >= '0' && c <= '9') { x = (x << 1) + (x << 3) + c - '0'; c = getchar_unlocked(); } return x; } void phongbeo(); const int inf = 1e15; const int mod2 = 1e9 + 9; const int mod1 = 998244353; struct icd { long double a; int b; }; struct ib { int a; int b; }; struct ic { int a, b, c; }; struct id { int a, b, c, d; }; struct ie { int a, b, c, d, e; }; int n, m, s1, s2, s4, s3, sf, k, s5, s6, mx, s7, s8, s9, mx2, res, dem2 = 0, dem = 0, s33, dem3, dem4, l, r, mid, l2, r2, center; int i, s10, s12,k1,k2,s11; int kk; int el = 19; main() { //fin(task); // fou(task); NHP /// cin>>s1; ///modwwe phongbeo(); // checktime } int s,t; int a[200001]; int b[200001]; vector<ib> v[200001]; struct cmp { bool operator()(ib a,ib b) { return a.b>b.b; } }; void dist(int x,int c[]) { priority_queue<ib,vector<ib>,cmp>p; p.push({x,0}); while(!p.empty()) { ib x=p.top(); p.pop(); if(c[x.a]!=-1) continue; c[x.a]=x.b; for(auto f:v[x.a]) if(c[f.a]==-1) p.push({f.a,f.b+x.b}); } } void phongbeo() { cin>>n>>m; cin>>s>>t>>l>>k; for(int i=1; i<=m; i++) cin>>s2>>s3>>s4,v[s2].pb({s3,s4}),v[s3].pb({s2,s4}); for(int i=1; i<=n; i++) a[i]=-1,b[i]=-1; dist(s,a); dist(t,b); for(int i=1; i<=n; i++) { if(a[i]==-1) a[i]=inf; if(b[i]==-1) b[i]=inf; } if(a[t]<=k) { cout<<n*(n-1)/2; } else { sort(b+1,b+1+n); for(int i=1; i<=n; i++) { if(a[i]==inf) continue; s3=k-a[i]-l; s4=upper_bound(b,b+1+n,s3)-b-1; s5=s5+max(0ll,s4); } cout<<s5; } }

Compilation message (stderr)

Main.cpp:67:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   67 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...