/*
* @Author: hungeazy
* @Date: 2024-08-02 08:28:06
* @Last Modified by: hungeazy
* @Last Modified time: 2024-08-02 09:29:19
*/
#include <bits/stdc++.h>
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define ull unsigned long long
#define sz(x) x.size()
#define sqr(x) (1LL * (x) * (x))
#define all(x) x.begin(), x.end()
#define fill(f,x) memset(f,x,sizeof(f))
#define FOR(i,l,r) for(int i=l;i<=r;i++)
#define FOD(i,r,l) for(int i=r;i>=l;i--)
#define ii pair<int,int>
#define iii pair<int,ii>
#define di pair<ii,ii>
#define vi vector<int>
#define vii vector<ii>
#define mii map<int,int>
#define fi first
#define se second
#define pb push_back
#define MOD 1000000007
#define __lcm(a,b) (1ll * ((a) / __gcd((a), (b))) * (b))
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define MASK(i) (1LL << (i))
#define c_bit(i) __builtin_popcountll(i)
#define BIT(x,i) ((x) & MASK(i))
#define SET_ON(x,i) ((x) | MASK(i))
#define SET_OFF(x,i) ((x) & ~MASK(i))
#define oo 1e18
#define name ""
#define endl '\n'
#define time() cerr << endl << "-------------Time:" << 1000.0 * clock() / CLOCKS_PER_SEC << "ms.";
template<typename T> bool maximize(T &res, const T &val) { if (res < val){ res = val; return true; }; return false; }
template<typename T> bool minimize(T &res, const T &val) { if (res > val){ res = val; return true; }; return false; }
const int N = (int)1e6+10;
ii a[N];
char c[N];
int r[N],h,w,n;
namespace sub1 {
vector<vi> b;
void BFS(ii p, int r, int type)
{
int val = (type?1:-1);
int cnt = 0; bool check = false;
FOR(i,p.fi-r,p.fi+r+1)
{
FOR(j,p.se-cnt,p.se+cnt)
b[i][j] += val;
if (!check) cnt++;
else cnt--;
if (cnt-1 == r) check = true, cnt -= 2;
}
}
void solve(void)
{
b.resize(h+10,vi(w+10));
FOR(i,1,n)
if (c[i] == 'W') BFS(a[i],r[i],1);
else BFS(a[i],r[i],0);
int ans = 0, res = 0;
FOR(i,0,h-1)
FOR(j,0,w-1) ans += b[i][j] >= 1, res += (b[i][j] < 0);
cout << ans << " " << res;
}
}
signed main()
{
fast;
if (fopen(name".inp","r"))
{
freopen(name".inp","r",stdin);
freopen(name".out","w",stdout);
}
cin >> h >> w >> n;
FOR(i,1,n) cin >> c[i] >> a[i].fi >> a[i].se >> r[i];
sub1::solve();
time();
return 0;
}
// ██░ ██ █ ██ ███▄ █ ▄████
//▓██░ ██▒ ██ ▓██▒ ██ ▀█ █ ██▒ ▀█▒
//▒██▀▀██░▓██ ▒██░▓██ ▀█ ██▒▒██░▄▄▄░
//░▓█ ░██ ▓▓█ ░██░▓██▒ ▐▌██▒░▓█ ██▓
//░▓█▒░██▓▒▒█████▓ ▒██░ ▓██░░▒▓███▀▒
// ▒ ░░▒░▒░▒▓▒ ▒ ▒ ░ ▒░ ▒ ▒ ░▒ ▒
// ▒ ░▒░ ░░░▒░ ░ ░ ░ ░░ ░ ▒░ ░ ░
// ░ ░░ ░ ░░░ ░ ░ ░ ░ ░ ░ ░ ░
// ░ ░ ░ ░ ░ ░
Compilation message
dominance.cpp: In function 'int main()':
dominance.cpp:87:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
87 | freopen(name".inp","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
dominance.cpp:88:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
88 | freopen(name".out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Runtime error |
24 ms |
65536 KB |
Execution killed with signal 9 |
3 |
Runtime error |
27 ms |
65536 KB |
Execution killed with signal 9 |
4 |
Runtime error |
15 ms |
65536 KB |
Execution killed with signal 9 |
5 |
Runtime error |
18 ms |
65536 KB |
Execution killed with signal 9 |
6 |
Runtime error |
5 ms |
9052 KB |
Execution killed with signal 6 |
7 |
Runtime error |
26 ms |
65536 KB |
Execution killed with signal 9 |
8 |
Runtime error |
19 ms |
65536 KB |
Execution killed with signal 9 |
9 |
Runtime error |
18 ms |
65536 KB |
Execution killed with signal 9 |
10 |
Runtime error |
56 ms |
65536 KB |
Execution killed with signal 9 |
11 |
Runtime error |
18 ms |
65536 KB |
Execution killed with signal 9 |
12 |
Runtime error |
17 ms |
65536 KB |
Execution killed with signal 9 |
13 |
Runtime error |
17 ms |
65536 KB |
Execution killed with signal 9 |
14 |
Correct |
1 ms |
5212 KB |
Output is correct |
15 |
Runtime error |
25 ms |
65536 KB |
Execution killed with signal 9 |
16 |
Correct |
72 ms |
12380 KB |
Output is correct |
17 |
Correct |
3 ms |
12428 KB |
Output is correct |
18 |
Runtime error |
14 ms |
65536 KB |
Execution killed with signal 9 |
19 |
Correct |
1 ms |
4700 KB |
Output is correct |
20 |
Correct |
11 ms |
23132 KB |
Output is correct |