-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathj123_運貨站.cpp
61 lines (55 loc) · 1.2 KB
/
j123_運貨站.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <bits/stdc++.h>
#define int long long
#define X first
#define Y second
#define Cheng0928 ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//#define size(a) signed(a.size());
using namespace std;
vector<int> a{1,1,1,1}, b{3}, c{2,2}, d{1,3}, e{1,2,2};
int R,C,n, ept;
int x_pos[50];
vector<int> block_type(char t){
if(t == 'A') return a;
if(t == 'B') return b;
if(t == 'C') return c;
if(t == 'D') return d;
if(t == 'E') return e;
}
bool push_block(char t, int y){
vector<int> block;
block = block_type(t);
int sz = block.size() - 1;int i = 0;
int x = 0;
while(i <= sz){
//cout << x_pos[i] << '\n';
x = max(x, x_pos[y + i] + block[i]);
i++;
}
//cout << x << ' ';
if(x > C) return 0;
i = 0;
for(i;i<=sz;i++){
x_pos[y + i] = x;
ept-=block[i];
}
return 1;
}
void sol(){
cin >> R >> C >> n;
ept = R * C;int trash = 0;
while(n--){
char t;int y;
cin >> t >> y;
if(!push_block(t,y)) trash++;
//else cout << "true\n";
}
cout << ept << ' ' << trash << '\n';
}
signed main()
{
Cheng0928
/*int t;
cin >> t;
while(t--) */sol();
return 0;
}