Submission #2114150
Source Code Expand
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
using namespace std;
using ll = long long;
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n
const ll MOD = (ll)1e9 + 7;
int main() {
int W,H,N;
cin >> W >> H >> N;
VI x(N), y(N), a(N);
REP(i, N) cin >> x[i] >> y[i] >> a[i];
int left = 0, right = W, bottom = 0, top = H;
REP(i, N){
if (a[i] == 1) left = max(left, x[i]);
if (a[i] == 2) right = min(right, x[i]);
if (a[i] == 3) bottom = max(bottom, y[i]);
if (a[i] == 4) top = min(top, y[i]);
}
cout << (((right - left) > 0 && (top - bottom) > 0) ? (right - left)*(top - bottom):0) << endl;
return 0;
}
Submission Info
Judge Result
Set Name |
sample |
All |
Score / Max Score |
0 / 0 |
200 / 200 |
Status |
|
|
Set Name |
Test Cases |
sample |
sample_01.txt, sample_02.txt, sample_03.txt |
All |
dir_01.txt, dir_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, small_03.txt, small_04.txt |
Case Name |
Status |
Exec Time |
Memory |
dir_01.txt |
AC |
1 ms |
256 KB |
dir_02.txt |
AC |
1 ms |
256 KB |
random_01.txt |
AC |
1 ms |
256 KB |
random_02.txt |
AC |
1 ms |
256 KB |
random_03.txt |
AC |
1 ms |
256 KB |
random_04.txt |
AC |
1 ms |
256 KB |
sample_01.txt |
AC |
1 ms |
256 KB |
sample_02.txt |
AC |
1 ms |
256 KB |
sample_03.txt |
AC |
1 ms |
256 KB |
small_01.txt |
AC |
1 ms |
256 KB |
small_02.txt |
AC |
1 ms |
256 KB |
small_03.txt |
AC |
1 ms |
256 KB |
small_04.txt |
AC |
1 ms |
256 KB |