Submission #1243552

#TimeUsernameProblemLanguageResultExecution timeMemory
1243552gaga999Usmjeravanje (COCI22_usmjeravanje)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const int size=4e5+5; int n,m,ecnt,tim,top,scc_cnt,dir[size]; int dfn[size],sta[size],low[size],ins[size]; vector<int> g[size]; struct edge{ int x,y,id; }e[size]; bool cmp(edge a,edge b) { return a.x!=b.x?a.x<b.x:a.y>b.y; }//排序 void tarjan(int u) { sta[++top]=u; ins[u]=1; dfn[u]=low[u]=++tim; for(int i=0;i<g[u].size();i++) { int v=g[u][i]; if(!dfn[v]) tarjan(v) , low[u]=min(low[u],low[v]); else if(ins[v]) low[u]=min(low[u],dfn[v]); } if(low[u]==dfn[u]) { scc_cnt++; int v; do{ v=sta[top]; top--; ins[v]=0; }while(v!=u); } } int main() { scanf("%d%d",&n,&m); for(int i=1;i<n;i++) g[i].push_back(i+1); for(int i=1;i<m;i++) g[i+n].push_back(i+n+1); //把右河岸的点并入 scanf("%d",&ecnt); int x,y; for(int i=1;i<=ecnt;i++) scanf("%d%d",&e[i].x,&e[i].y), e[i].id=i; sort(e+1,e+1+ecnt,cmp); int hy=0; for(int i=1;i<=ecnt;i++) { if(e[i].y>hy) { g[e[i].y+n].push_back(e[i].x); hy=e[i].y; dir[e[i].id]=1; } else g[e[i].x].push_back(e[i].y+n); } n+=m; for(int i=1;i<=n;i++) if(!dfn[i])tarjan(i); printf("%d\n",scc_cnt); for(int i=1;i<=ecnt;i++) printf("%d ",dir[i]); return 0; }

Compilation message (stderr)

Main.cpp:4:34: error: reference to 'size' is ambiguous
    4 | int n,m,ecnt,tim,top,scc_cnt,dir[size];
      |                                  ^~~~
In file included from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/11/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
Main.cpp:3:11: note:                 'const int size'
    3 | const int size=4e5+5;
      |           ^~~~
Main.cpp:5:9: error: reference to 'size' is ambiguous
    5 | int dfn[size],sta[size],low[size],ins[size];
      |         ^~~~
In file included from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/11/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
Main.cpp:3:11: note:                 'const int size'
    3 | const int size=4e5+5;
      |           ^~~~
Main.cpp:5:19: error: reference to 'size' is ambiguous
    5 | int dfn[size],sta[size],low[size],ins[size];
      |                   ^~~~
In file included from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/11/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
Main.cpp:3:11: note:                 'const int size'
    3 | const int size=4e5+5;
      |           ^~~~
Main.cpp:5:29: error: reference to 'size' is ambiguous
    5 | int dfn[size],sta[size],low[size],ins[size];
      |                             ^~~~
In file included from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/11/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
Main.cpp:3:11: note:                 'const int size'
    3 | const int size=4e5+5;
      |           ^~~~
Main.cpp:5:39: error: reference to 'size' is ambiguous
    5 | int dfn[size],sta[size],low[size],ins[size];
      |                                       ^~~~
In file included from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/11/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
Main.cpp:3:11: note:                 'const int size'
    3 | const int size=4e5+5;
      |           ^~~~
Main.cpp:6:15: error: reference to 'size' is ambiguous
    6 | vector<int> g[size];
      |               ^~~~
In file included from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/11/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
Main.cpp:3:11: note:                 'const int size'
    3 | const int size=4e5+5;
      |           ^~~~
Main.cpp:9:4: error: reference to 'size' is ambiguous
    9 | }e[size];
      |    ^~~~
In file included from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/11/bits/range_access.h:254:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  254 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/11/bits/range_access.h:245:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  245 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
Main.cpp:3:11: note:                 'const int size'
    3 | const int size=4e5+5;
      |           ^~~~
Main.cpp: In function 'void tarjan(int)':
Main.cpp:14:9: error: 'sta' was not declared in this scope; did you mean 'std'?
   14 |         sta[++top]=u; ins[u]=1;
      |         ^~~
      |         std
Main.cpp:14:23: error: 'ins' was not declared in this scope; did you mean 'int'?
   14 |         sta[++top]=u; ins[u]=1;
      |                       ^~~
      |                       int
Main.cpp:15:9: error: 'dfn' was not declared in this scope
   15 |         dfn[u]=low[u]=++tim;
      |         ^~~
Main.cpp:15:16: error: 'low' was not declared in this scope; did you mean 'pow'?
   15 |         dfn[u]=low[u]=++tim;
      |                ^~~
      |                pow
Main.cpp:16:23: error: 'g' was not declared in this scope
   16 |         for(int i=0;i<g[u].size();i++)
      |                       ^
Main.cpp: In function 'int main()':
Main.cpp:37:17: error: 'g' was not declared in this scope
   37 |                 g[i].push_back(i+1);
      |                 ^
Main.cpp:39:17: error: 'g' was not declared in this scope
   39 |                 g[i+n].push_back(i+n+1); //把右河岸的点并入
      |                 ^
Main.cpp:43:31: error: 'e' was not declared in this scope; did you mean 'std::numbers::e'?
   43 |                 scanf("%d%d",&e[i].x,&e[i].y), e[i].id=i;
      |                               ^
      |                               std::numbers::e
In file included from /usr/include/c++/11/bits/max_size_type.h:37,
                 from /usr/include/c++/11/bits/ranges_base.h:38,
                 from /usr/include/c++/11/string_view:48,
                 from /usr/include/c++/11/bits/basic_string.h:48,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/11/numbers:122:27: note: 'std::numbers::e' declared here
  122 |   inline constexpr double e = e_v<double>;
      |                           ^
Main.cpp:44:14: error: 'e' was not declared in this scope; did you mean 'std::numbers::e'?
   44 |         sort(e+1,e+1+ecnt,cmp);
      |              ^
      |              std::numbers::e
In file included from /usr/include/c++/11/bits/max_size_type.h:37,
                 from /usr/include/c++/11/bits/ranges_base.h:38,
                 from /usr/include/c++/11/string_view:48,
                 from /usr/include/c++/11/bits/basic_string.h:48,
                 from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Main.cpp:1:
/usr/include/c++/11/numbers:122:27: note: 'std::numbers::e' declared here
  122 |   inline constexpr double e = e_v<double>;
      |                           ^
Main.cpp:50:25: error: 'g' was not declared in this scope
   50 |                         g[e[i].y+n].push_back(e[i].x);
      |                         ^
Main.cpp:51:36: error: 'dir' was not declared in this scope; did you mean 'div'?
   51 |                         hy=e[i].y; dir[e[i].id]=1;
      |                                    ^~~
      |                                    div
Main.cpp:53:22: error: 'g' was not declared in this scope
   53 |                 else g[e[i].x].push_back(e[i].y+n);
      |                      ^
Main.cpp:57:21: error: 'dfn' was not declared in this scope
   57 |                 if(!dfn[i])tarjan(i);
      |                     ^~~
Main.cpp:60:30: error: 'dir' was not declared in this scope; did you mean 'div'?
   60 |                 printf("%d ",dir[i]);
      |                              ^~~
      |                              div
Main.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |         scanf("%d%d",&n,&m);
      |         ~~~~~^~~~~~~~~~~~~~
Main.cpp:40:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |         scanf("%d",&ecnt);
      |         ~~~~~^~~~~~~~~~~~