제출 #1179524

#제출 시각아이디문제언어결과실행 시간메모리
1179524PlayVoltzTwo Transportations (JOI19_transportations)C++20
컴파일 에러
0 ms0 KiB
#include "Azer.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second namespace{ int count=0, val=0, phase=0, tempval; vector<int> dist, done, notdone; vector<bool> del; vector<deque<pii> > graph; } void InitA(int n, int a, vector<int> u, vector<int> v, vector<int> c){ done.clear(); dist.clear(); graph.clear(); del.clear(); del.resize(n, 0); done.resize(1, 0); dist.resize(n, LLONG_MAX/2); graph.resize(n); dist[0]=count=val=phase=0; del[0]=1; for (int i=1; i<n; ++i)notdone.pb(i); for (int i=0; i<a; ++i){ graph[u[i]].pb(mp(c[i], v[i])); graph[v[i]].pb(mp(c[i], u[i])); } for (int i=0; i<n; ++i)sort(graph[i].begin(), graph[i].end()); } void ReceiveA(bool x){ ++count; val=val*2+x; if (!phase&&count==9){ int mn=LLONG_MAX/2, dj=LLONG_MAX/2, best; for (auto node:done){ while (graph[node].size()&&del[graph[node][0].se])graph[node].pop_front(); if (graph[node].empty())continue; mn=min(mn, dist[node]); if (dist[node]+graph[node][0].fi<dj)dj=dist[node]+graph[node][0].fi, best=graph[node][0].se; } if (dj-mn<val){ SendB(0); dist[best]=dj; done.pb(best); del[best]=1; int id=0; for (int i=0; i<notdone.size(); ++i)if (notdone[i]==best)id=i; notdone.erase(find(notdone.begin(), notdone.end(), best)); for (int i=log2(notdone.size()+1)+1; i>=0; --i)SendB((1<<i)&id); for (int i=8; i>=0; --i)SendB((1<<i)&dj); } else{ SendB(1); phase=1; } count=val=0; } if (phase==1&&count==log2(notdone.size())+1){ tempval=val; phase=2; count=val=0; } if (phase==2&&count==9){ int best=notdone[val]; dist[best]=dj; done.pb(best); del[best]=1; notdone.erase(find(notdone.begin(), notdone.end(), best)); phase=count=val=0; } } vector<int> Answer(){ return dist; }
#include "Baijan.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define mp make_pair #define pb push_back #define fi first #define se second namespace{ int count=0, val=0, phase=0, tempval; vector<int> dist, done, notdone; vector<bool> del; vector<deque<pii> > graph; } void InitA(int n, int a, vector<int> u, vector<int> v, vector<int> c){ done.clear(); dist.clear(); graph.clear(); del.clear(); del.resize(n, 0); done.resize(1, 0); dist.resize(n, LLONG_MAX/2); graph.resize(n); dist[0]=count=val=phase=0; del[0]=1; for (int i=1; i<n; ++i)notdone.pb(i); for (int i=0; i<a; ++i){ graph[u[i]].pb(mp(c[i], v[i])); graph[v[i]].pb(mp(c[i], u[i])); } for (int i=0; i<n; ++i)sort(graph[i].begin(), graph[i].end()); } void ReceiveB(bool x){ ++count; val=val*2+x; if (!phase){ if (val){ dist[best]=dj; done.pb(best); del[best]=1; int id=0; for (int i=0; i<notdone.size(); ++i)if (notdone[i]==best)id=i; notdone.erase(find(notdone.begin(), notdone.end(), best)); for (int i=log2(notdone.size()+1)+1; i>=0; --i)SendB((1<<i)&id); for (int i=8; i>=0; --i)SendB((1<<i)&dj); } else phase=1; val=count=0; } if (phase==1&&count==log2(notdone.size())+1){ tempval=val; phase=2; count=val=0; } if (phase==2&&count==9){ int best=notdone[val]; dist[best]=dj; done.pb(best); del[best]=1; notdone.erase(find(notdone.begin(), notdone.end(), best)); phase=count=val=0; } }

컴파일 시 표준 에러 (stderr) 메시지

# 1번째 컴파일 단계

Azer.cpp: In function 'void InitA(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Azer.cpp:25:33: warning: overflow in conversion from 'long long int' to 'std::vector<int>::value_type' {aka 'int'} changes value from '4611686018427387903' to '-1' [-Woverflow]
   25 |         dist.resize(n, LLONG_MAX/2);
      |                                 ^
Azer.cpp:27:17: error: reference to 'count' is ambiguous
   27 |         dist[0]=count=val=phase=0;
      |                 ^~~~~
Azer.cpp:12:13: note: candidates are: 'int {anonymous}::count'
   12 |         int count=0, val=0, phase=0, tempval;
      |             ^~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Azer.cpp:2:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:101:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/11/vector:62,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Azer.cpp: In function 'void ReceiveA(bool)':
Azer.cpp:38:11: error: reference to 'count' is ambiguous
   38 |         ++count;
      |           ^~~~~
Azer.cpp:12:13: note: candidates are: 'int {anonymous}::count'
   12 |         int count=0, val=0, phase=0, tempval;
      |             ^~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Azer.cpp:2:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:101:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/11/vector:62,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Azer.cpp:40:21: error: reference to 'count' is ambiguous
   40 |         if (!phase&&count==9){
      |                     ^~~~~
Azer.cpp:12:13: note: candidates are: 'int {anonymous}::count'
   12 |         int count=0, val=0, phase=0, tempval;
      |             ^~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Azer.cpp:2:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:101:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/11/vector:62,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Azer.cpp:41:33: warning: overflow in conversion from 'long long int' to 'int' changes value from '4611686018427387903' to '-1' [-Woverflow]
   41 |                 int mn=LLONG_MAX/2, dj=LLONG_MAX/2, best;
      |                                 ^
Azer.cpp:41:49: warning: overflow in conversion from 'long long int' to 'int' changes value from '4611686018427387903' to '-1' [-Woverflow]
   41 |                 int mn=LLONG_MAX/2, dj=LLONG_MAX/2, best;
      |                                                 ^
Azer.cpp:49:25: error: 'SendB' was not declared in this scope; did you mean 'SendA'?
   49 |                         SendB(0);
      |                         ^~~~~
      |                         SendA
Azer.cpp:60:25: error: 'SendB' was not declared in this scope; did you mean 'SendA'?
   60 |                         SendB(1);
      |                         ^~~~~
      |                         SendA
Azer.cpp:63:17: error: reference to 'count' is ambiguous
   63 |                 count=val=0;
      |                 ^~~~~
Azer.cpp:12:13: note: candidates are: 'int {anonymous}::count'
   12 |         int count=0, val=0, phase=0, tempval;
      |             ^~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Azer.cpp:2:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:101:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/11/vector:62,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Azer.cpp:65:23: error: reference to 'count' is ambiguous
   65 |         if (phase==1&&count==log2(notdone.size())+1){
      |                       ^~~~~
Azer.cpp:12:13: note: candidates are: 'int {anonymous}::count'
   12 |         int count=0, val=0, phase=0, tempval;
      |             ^~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Azer.cpp:2:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:101:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/11/vector:62,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Azer.cpp:68:17: error: reference to 'count' is ambiguous
   68 |                 count=val=0;
      |                 ^~~~~
Azer.cpp:12:13: note: candidates are: 'int {anonymous}::count'
   12 |         int count=0, val=0, phase=0, tempval;
      |             ^~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Azer.cpp:2:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:101:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/11/vector:62,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Azer.cpp:70:23: error: reference to 'count' is ambiguous
   70 |         if (phase==2&&count==9){
      |                       ^~~~~
Azer.cpp:12:13: note: candidates are: 'int {anonymous}::count'
   12 |         int count=0, val=0, phase=0, tempval;
      |             ^~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Azer.cpp:2:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:101:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/11/vector:62,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
Azer.cpp:72:28: error: 'dj' was not declared in this scope
   72 |                 dist[best]=dj;
      |                            ^~
Azer.cpp:76:23: error: reference to 'count' is ambiguous
   76 |                 phase=count=val=0;
      |                       ^~~~~
Azer.cpp:12:13: note: candidates are: 'int {anonymous}::count'
   12 |         int count=0, val=0, phase=0, tempval;
      |             ^~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Azer.cpp:2:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:101:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/11/vector:62,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4059:5: note:                 'template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4059 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~