#include<cstdio>
int main()
{
int i,j,n,m;
scanf("%d%d",&n,&m);
if(n&1)
{
if(m&1)
{
}
else
{
printf("%d\n",2*n*m);
for(i=m;i>=1;i--)primtf("%d 1 1\m%d 1 0\m",i,i);
for(i=1;i<=m;i++)
{
if(i&1)for(j=2;j<=n;j++)primtf("%d %d 0\m%d %d 1\m",i,j,i,j);
else for(j=n;j>=2;j--)
{
if(j&1)primtf("%d %d 1\m%d %d 0\m",i,j,i,j);
else primtf("%d %d 0\m%d %d 1\m",i,j,i,j);
}
}
}
}
else
{
printf("%d\n",2*n*m);
for(i=n;i>=1;i--)printf("%d 1 1\n%d 1 0\n",i,i);
for(i=1;i<=n;i++)
{
if(i&1)for(j=2;j<=m;j++)printf("%d %d 0\n%d %d 1\n",i,j,i,j);
else for(j=m;j>=2;j--)
{
if(j&1)printf("%d %d 1\n%d %d 0\n",i,j,i,j);
else printf("%d %d 0\n%d %d 1\n",i,j,i,j);
}
}
}
}
Compilation message
block.cpp: In function 'int main()':
block.cpp:15:28: warning: unknown escape sequence: '\m' [enabled by default]
block.cpp:15:28: warning: unknown escape sequence: '\m' [enabled by default]
block.cpp:15:50: error: 'primtf' was not declared in this scope
block.cpp:18:36: warning: unknown escape sequence: '\m' [enabled by default]
block.cpp:18:36: warning: unknown escape sequence: '\m' [enabled by default]
block.cpp:18:64: error: 'primtf' was not declared in this scope
block.cpp:21:20: warning: unknown escape sequence: '\m' [enabled by default]
block.cpp:21:20: warning: unknown escape sequence: '\m' [enabled by default]
block.cpp:21:48: error: 'primtf' was not declared in this scope
block.cpp:22:18: warning: unknown escape sequence: '\m' [enabled by default]
block.cpp:22:18: warning: unknown escape sequence: '\m' [enabled by default]
block.cpp:22:46: error: 'primtf' was not declared in this scope
block.cpp:6:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]