Submission #1202956

#TimeUsernameProblemLanguageResultExecution timeMemory
1202956VahanAbrahamCyberland (APIO23_cyberland)C++20
Compilation error
0 ms0 KiB
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <string> #include <algorithm> #include <cstring> #include <cstdio> #include <sstream> #include <map> #include <stack> #include <set> #include <queue> #include <deque> #include <unordered_set> #include <unordered_map> #include <math.h> #include <cmath> #include <vector> #include <iomanip> #include <random> #include <chrono> #include <bitset> #include <cassert> using namespace std; #define ll long long #define fr first #define sc second #define pb push_back #define US freopen(".in", "r", stdin); freopen(".out", "w", stdout); ll gcd(ll a, ll b) { if (a == 0 || b == 0) { return max(a, b); } if (a <= b) { return gcd(a, b % a); } else { return gcd(a % b, b); } } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } const int N = 100005; const ll oo = 1000000000000000, MOD = 1000000007; vector<pair<int,int>> g[N]; double dist[N][30]; double solve(int n,int m,int k,int h,vector<int> vec1,vector<int> vec2,vector<int> vec3,vector<int> a) { for(int i=0;i<m;++i){ g[vec1[i]].pb({vec2[i],vec3[i]}); g[vec2[i]].pb({vec1[i],vec3[i]}); } for(int i=0;i<n;++i){ for(int j=0;j<=k;++j){ dist[i][j]=oo; } } dist[0][0]=0; set<pair<double,pair<int,int>>> st; st.insert({dist[0][0],{0,0}}); while((int)st.size>0){ auto it=st.begin(); pair<double,pair<int,int>> p=(*it); st.erase(it); int k1=p.sc.fr; int u=p.sc.sc; double val=p.fr; if(dist[u][k1]!=val || u==h){ continue; } double val2=val / (2.0); for(pair<int,int> num : g[u]){ int h =num.fr; int w=num.sc; if(k1<k){ if(a[u]==0){ if(dist[h][k1+1]>w){ dist[h][k1+1]=w; st.insert({dist[h][k1+1],{k1+1,h}}); } if(dist[h][k1]>val+w){ dist[h][k1]=val+w; st.insert({dist[h][k1],{k1,h}}); } } else{ if(a[u]==2){ if(dist[h][k1+1]>val2+w){ dist[h][k1+1]=val2+w; st.insert({dist[h][k1+1],{k1+1,h}}); } if(dist[h][k1]>val+w){ dist[h][k1]=val+w; st.insert({dist[h][k1],{k1,h}}); } } else{ if(dist[h][k1]>val+w){ dist[h][k1]=val+w; st.insert({dist[h][k1],{k1,h}}); } } } } else{ if(a[u]==0){ if(dist[h][k1]>val+w){ dist[h][k1]=val+w; st.insert({dist[h][k1],{k1,h}}); } } else{ if(a[u]==2){ if(dist[h][k1]>val+w){ dist[h][k1]=val+w; st.insert({dist[h][k1],{k1,h}}); } } else{ if(dist[h][k1]>val+w){ dist[h][k1]=val+w; st.insert({dist[h][k1],{k1,h}}); } } } } } } double mn=oo; for(int i=0;i<=k;++i){ mn=min(mn,dist[h][i]); } if(mn==oo){ return -1; } return mn; } //https://oj.uz/problem/view/APIO23_cyberland /*int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //US int tt = 1; //cin >> tt; while (tt--) { solve(); } }*/

Compilation message (stderr)

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:67:19: error: invalid use of member function 'std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::size() const [with _Key = std::pair<double, std::pair<int, int> >; _Compare = std::less<std::pair<double, std::pair<int, int> > >; _Alloc = std::allocator<std::pair<double, std::pair<int, int> > >; std::set<_Key, _Compare, _Alloc>::size_type = long unsigned int]' (did you forget the '()' ?)
   67 |     while((int)st.size>0){
      |                ~~~^~~~
      |                       ()