이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "rainbow.h"
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define OR |
typedef long long ll ;
const ll ooo = 1e14 ;
const ll oo = 2e9 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7 ;
const int N = 10000010 ;
int r[4] = {1 , -1 , 0 , 0} ,
c[4] = {0 , 0 , 1 , -1} ;
map<char,int> mp;
bool vis[52][52];
int ln , lm , rn , rm;
string g[52];
void init(int R, int C, int sr, int sc, int M, char *S) {
mp['N'] = 1;
mp['S'] = 0;
mp['E'] = 2;
mp['W'] = 3;
for(int i = 1 ; i <= R ; ++i)
for(int j = 0 ; j <= C ; ++j) g[i] += '.';
g[sr][sc] = '#';
for(int i = 0 ; i < M ; ++i){
sr += r[mp[S[i]]];
sc += c[mp[S[i]]];
g[sr][sc] = '#';
}
}
void dfs(int i , int j){
if(i == ln - 1 or j == lm - 1 or i == rn + 1 or j == rm + 1) return;
if(g[i][j] == '#' or vis[i][j])return;
vis[i][j] = 1;
for(int k = 0 ; k < 4; ++k){
dfs(i + r[k] , j + c[k]);
}
}
// g++ -Wall -lm -static -DEVAL -o rainbow -O2 rainbow.cpp grader.cpp -std=c++14
int colour(int ar, int ac, int br, int bc) {
int ans = 0 ;
ln = ar;
lm = ac;
rn = br;
rm = bc;
for(int i = ar ; i <= br ; ++i)
for(int j = ac ; j <= bc ; ++j) vis[i][j] = 0;
for(int i = ar ; i <= br ; ++i)
for(int j = ac ; j <= bc ; ++j){
if(g[i][j] == '#' or vis[i][j]) continue;
ans++;
dfs(i , j);
}
return ans ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |