Submission #1098533

#TimeUsernameProblemLanguageResultExecution timeMemory
1098533vjudge1Evacuation plan (IZhO18_plan)C++17
Compilation error
0 ms0 KiB
//UNSTOPPABLE #include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #define ll long long #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define int long long #define F first #define S second #define all(x) (x).begin(), (x).end() #define pii pair<int,int> #define sigma signed #define tpii pair <pair <int,int> , int> #define bruh cout << "NO\n" using namespace std; using namespace __gnu_pbds; const int N = 5e5 + 5; int mod = 1e9 + 7; const int INF = 1e18; int n,m,k,q,a[N],dist[N],used[N],p[N],s[N],t[N],ans[N]; vector <pii> g[N]; int get(int x){ if(p[x] == x) return x; return p[x] = get(p[x]); } void merge(int v , int u){ v = get(v); u = get(u); p[v] = u; } void Goldik(){ cin >> n >> m; for(int i = 1 ; i <= m ; i++){ int u,v,w; cin >> u >> v >> w; g[u].pb({v , w}); g[v].pb({u , w}); } cin >> k; set <pii> st; for(int i = 1 ; i <= n ; i++){ dist[i] = INF; } for(int i = 1 ; i <= k ; i++){ cin >> a[i]; dist[a[i]] = 0; used[a[i]] = 1; st.insert({0 , a[i]}); } while(st.size()){ int v = (*st.begin()).F; st.erase(*st.begin()); used[v] = 1; for(auto to : g[v]){ if(used[to.F]) continue; if(dist[to.F] > dist[v] + to.S){ dist[to.F] = dist[v] + to.S; st.insert({dist[to.F] , to.F}); } } } vector <int> qu; cin >> q; for(int i = 1 ; i <= q ; i++){ cin >> s[i] >> t[i]; qu.pb({(1e8 / 2) , i}); l[i] = 0 , r[i] = 1e8; } while(true){ for(int i = 1 ; i <= n ; i++) p[i] = i; for(int i = 0 ; i < qu.size() ; i++){ qu[i].F = l[i] + r[i] >> 1; } sort(all(qu)); bool ok = 0; for(auto it : qu){ int md = it.F , i = it.S; if(l[i] > r[i]){ ans[i] = r[i]; ok = 1; } } if(ok) break; reverse(all(qu)); for(auto it : qu){ } } } //rewai mnogo zadach vozmozhno odna iz nih gde to popadetsya //returning winter prime? //chem prowe tem luchshe sigma main(/*AZ AZDAN UZDIKSIZ*/){ //freopen("txt.in","r",stdin); //freopen("txt.out","w",stdout); ios_base::sync_with_stdio(0); cin.tie(0); srand(time(0)); int TT = 1; // cin >> TT; for(int i = 1 ; i <= TT ; i++){ //cout << "Case " << i << ": "; Goldik(); } }

Compilation message (stderr)

plan.cpp: In function 'void Goldik()':
plan.cpp:68:24: error: no matching function for call to 'std::vector<long long int>::push_back(<brace-enclosed initializer list>)'
   68 |   qu.pb({(1e8 / 2) , i});
      |                        ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from plan.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const long long int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<long long int>::value_type&&' {aka 'long long int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
plan.cpp:69:3: error: 'l' was not declared in this scope
   69 |   l[i] = 0 , r[i] = 1e8;
      |   ^
plan.cpp:69:14: error: 'r' was not declared in this scope
   69 |   l[i] = 0 , r[i] = 1e8;
      |              ^
plan.cpp:73:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |   for(int i = 0 ; i < qu.size() ; i++){
      |                   ~~^~~~~~~~~~~
plan.cpp:10:11: error: request for member 'first' in 'qu.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   10 | #define F first
      |           ^~~~~
plan.cpp:74:10: note: in expansion of macro 'F'
   74 |    qu[i].F = l[i] + r[i] >> 1;
      |          ^
plan.cpp:74:14: error: 'l' was not declared in this scope
   74 |    qu[i].F = l[i] + r[i] >> 1;
      |              ^
plan.cpp:74:21: error: 'r' was not declared in this scope
   74 |    qu[i].F = l[i] + r[i] >> 1;
      |                     ^
plan.cpp:10:11: error: request for member 'first' in 'it', which is of non-class type 'long long int'
   10 | #define F first
      |           ^~~~~
plan.cpp:79:16: note: in expansion of macro 'F'
   79 |    int md = it.F , i = it.S;
      |                ^
plan.cpp:80:7: error: 'l' was not declared in this scope
   80 |    if(l[i] > r[i]){
      |       ^
plan.cpp:80:9: error: 'i' was not declared in this scope; did you mean 'it'?
   80 |    if(l[i] > r[i]){
      |         ^
      |         it
plan.cpp:80:14: error: 'r' was not declared in this scope
   80 |    if(l[i] > r[i]){
      |              ^
plan.cpp:79:8: warning: unused variable 'md' [-Wunused-variable]
   79 |    int md = it.F , i = it.S;
      |        ^~
plan.cpp:87:12: warning: unused variable 'it' [-Wunused-variable]
   87 |   for(auto it : qu){
      |            ^~