AcWing 农夫约翰的奶酪块
6122. 农夫约翰的奶酪块 - AcWing题库
第一眼唬人三维的题目,详细看注解
const int N = 1e3 + 10,T = 20;
int n,m;
LL a[N][N],b[N][N],c[N][N];
void solve()
{
cin >> n >> m;
LL res = 0;
for (int i = 1;i <= m;i ++)
{
int x,y,z;
cin >> x >> y >> z;
if (++a[x][y] == n) res ++; //xy面上,z轴坐标任意,输入保证切割的奶酪块不会重复,只需记录数量即可
if (++b[x][z] == n) res ++; //如果达到n,说明可以放置一个砖块,方案+1
if (++c[y][z] == n) res ++;
cout << res << endl;
}
}