답안 #948879

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
948879 2024-03-18T15:51:12 Z vjudge1 무지개나라 (APIO17_rainbow) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a: b)
#define pii pair<int, int>
#define fi first
#define se second

using namespace std;

bool river[55][55]{};

void init(int R, int C, int sr, int sc, int M, string S){
	if(R>50 || C>50) exit(0);
	river[sr][sc]=true;
	repa(e,S){
		if(e=='N') sr++;
		else if(e=='S') sr--;
		else if(e=='W') sc--;
		else sc++;
		river[sr][sc]=true;
	}
}

void colours(int ar, int ac, int br, int bc){
	bool vis[55][55]{};
	int c=0;
	rep(i,ar,br+1){
		rep(j,ac,bc+1){
			int x=i, y=j;
			if(vis[x][y]) continue;
			c++;
			queue<pii> q;
			q.push({x,y});
			while(q.size()){
				x=q.front().fi;
				y=q.front().se;
				q.pop();
				if(x+1<=br && !vis[x+1][y]) vis[x+1][y]=true, q.push({x+1,y});
				if(x-1>=ar && !vis[x-1][y]) vis[x-1][y]=true, q.push({x-1,y});
				if(y+1<=bc && !vis[x][y+1]) vis[x][y+1]=true, q.push({x,y+1});
				if(y-1>=ac && !vis[x][y-1]) vis[x][y-1]=true, q.push({x,y-1});
			}
		}
	}
	cout<<c<<endl;
}

Compilation message

/usr/bin/ld: /tmp/cchqL6CX.o: in function `main':
grader.cpp:(.text.startup+0xed): undefined reference to `init(int, int, int, int, int, char*)'
/usr/bin/ld: grader.cpp:(.text.startup+0x167): undefined reference to `colour(int, int, int, int)'
collect2: error: ld returned 1 exit status