제출 #1254267

#제출 시각아이디문제언어결과실행 시간메모리
1254267M_SH_O무지개나라 (APIO17_rainbow)C++20
11 / 100
3095 ms1114112 KiB
#include <bits/stdc++.h> #include "rainbow.h" #define ll long long #define ll1 long long #define ull unsigned long long #define dou long double #define str string #define vll vector<ll> #define vi vector<int> #define pll pair<ll, ll> #define vpll vector<pll> #define vbool vector<bool> #define vstr vector<str> #define vvll vector<vll> #define pb push_back #define pf push_front #define endl "\n" #define fr first #define se second // #define sortcmp(a) sort(a.begin(), a.end(), cmp) #define sort(a) sort(a.begin(), a.end()) #define reverse(a) reverse(a.begin(), a.end()) #define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> using namespace std; //using namespace __gnu_pbds; const ll INF = 1e18; const int lg = 20; mt19937 rng(time(0)); ll randll(ll l, ll r){ return uniform_int_distribution<ll>(l, r)(rng); } vector<vbool> a, us; void init(int n, int m, int x, int y, int k, char *s) { a.resize(n, vbool(m, 1)); us.resize(n, vbool(m, 0)); x --, y --; a[x][y] = 0; for(int i = 0; i < k; i ++){ if(s[i] == 'N') x --; else if(s[i] == 'S') x ++; else if(s[i] == 'W') y --; else y ++; a[x][y] = 0; } } void dfs(ll x, ll y, ll x1, ll y1, ll x2, ll y2){ if(x < x1 || x > x2 || y < y1 || y > y2 || us[x][y] || !a[x][y]) return; us[x][y] = 1; for(int i = -1; i <= 1; i += 2){ dfs(x+i, y, x1, y1, x2, y2); dfs(x, y+i, x1, y1, x2, y2); } } int colour(int x, int y, int xr, int yr) { int res = 0; for(int i = x-1; i < xr; i ++){ for(int j = y-1; j < yr; j ++){ if(us[i][j] || !a[i][j]) continue; res ++; dfs(i, j, x-1, y-1, xr-1, yr-1); } } for(int i = x-1; i < xr; i ++){ for(int j = y-1; j < yr; j ++){ us[i][j] = 0; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...