제출 #536654

#제출 시각아이디문제언어결과실행 시간메모리
536654ammar2000무지개나라 (APIO17_rainbow)C++17
컴파일 에러
0 ms0 KiB
#include "rainbow.h" #include<bits/stdc++.h> #define ll long long #define pb push_back #define F first #define S second #define coy cout<<"YES\n" #define con cout<<"NO\n" #define co1 cout<<"-1\n" #define sc(x) scanf("%lld",&x) #define all(x) x.begin(),x.end() #define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; const int SI=3e5+7; ll INF=8e18+7; int dx[] = {1 , -1 , 0 , 0}; int dy[] = {0 , 0 , 1 , -1}; int MOD=1e9+7; ll n,m,g[55][55]; ll vis[55][55],col; ll u,l,d,r; bool valid(int x,int y) { return x>=u&&x<=d&&y>=l&&y<=r&&g[x][y]==0&&vis[x][y]!=col; } void dfs(int x,int y) { // cout <<x<<" "<<y<<"\n"; vis[x][y]=col; for (int i=0;i<4;i++) { if (valid(x+dx[i],y+dy[i])) dfs(x+dx[i],y+dy[i]); } } void init(int R, int C, int sr, int sc, int M, char *S) { n=R,m=C; g[sr][sc]=1; for (auto i:S) { if (i=='N') sr--; else if (i=='S') sr++; else if (i=='E') sc++; else sc--; g[sr][sc]=1; } } int colour(int ar, int ac, int br, int bc) { col++; u=ar,l=ac,d=br,r=bc; ll ret=0; for (int i=ar;i<=br;i++) for (int u=ac;u<=bc;u++) { if (vis[i][u]!=col&&g[i][u]==0) ret++,dfs(i,u); } return ret; }

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

rainbow.cpp: In function 'void init(int, int, int, int, int, char*)':
rainbow.cpp:6:11: error: 'begin' was not declared in this scope
    6 | #define S second
      |           ^~~~~~
rainbow.cpp:39:17: note: in expansion of macro 'S'
   39 |     for (auto i:S)
      |                 ^
rainbow.cpp:6:11: note: suggested alternatives:
    6 | #define S second
      |           ^~~~~~
rainbow.cpp:39:17: note: in expansion of macro 'S'
   39 |     for (auto i:S)
      |                 ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from rainbow.cpp:2:
/usr/include/c++/10/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from rainbow.cpp:2:
/usr/include/c++/10/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
rainbow.cpp:6:11: error: 'end' was not declared in this scope
    6 | #define S second
      |           ^~~~~~
rainbow.cpp:39:17: note: in expansion of macro 'S'
   39 |     for (auto i:S)
      |                 ^
rainbow.cpp:6:11: note: suggested alternatives:
    6 | #define S second
      |           ^~~~~~
rainbow.cpp:39:17: note: in expansion of macro 'S'
   39 |     for (auto i:S)
      |                 ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from rainbow.cpp:2:
/usr/include/c++/10/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from rainbow.cpp:2:
/usr/include/c++/10/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~