Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int m[1000][1000];
- int main() {
- int a, b,c,m1,m2,m3;
- cin >> a >> b;
- cin>>c;
- for (int i=0;i<c;i++) {
- cin>>m1>>m2>>m3;
- if ((m1==1) && (m2<a) && (m2!=0) && (m3!=0) && (m3<b) && (m[m2][m3]==0)&& (m[m2-1][m3]==0)&& (m[m2][m3-1]==0)) {m[m2][m3]=1; m[m2-1][m3]=1; m[m2][m3-1]=1; }
- if ((m1==2) && (m2<a) && (m2!=0) && (m3!=0) && (m3<b) && (m[m2-1][m3-1]==0)&& (m[m2][m3]==0)&& (m[m2-1][m3]==0)) {m[m2-1][m3-1]=1; m[m2][m3]=1; m[m2-1][m3]=1; }
- if ((m1==3) && (m2<a) && (m2!=0) && (m3!=0) && (m3<b) && (m[m2][m3]==0)&& (m[m2][m3-1]==0)&& (m[m2-1][m3-1]==0)) {m[m2][m3]=1; m[m2][m3-1]=1; m[m2-1][m3-1]=1; }
- if ((m1==4) && (m2<a) && (m2!=0) && (m3!=0) && (m3<b) && (m[m2-1][m3-1]==0)&& (m[m2-1][m3]==0)&& (m[m2][m3-1]==0)) {m[m2-1][m3-1]=1; m[m2-1][m3]=1; m[m2][m3-1]=1; }
- }
- int ans=0;
- for (int i=0;i<b;i++) {
- for (int j=0;j<a;j++) if (m[i][j]==1) ans++;
- }
- cout<<ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement