Submission #3260223


Source Code Expand

#include <bits/stdc++.h>
#define MAXN 505
using namespace std;

struct e
{
	int a,b,c,d;
	e(){}
	e(int x,int xx,int xxx,int xxxx):a(x),b(xx),c(xxx),d(xxxx){}
	void print(){printf("%d %d %d %d\n",a,b,c,d);}
};

int n,m,h,a[MAXN][MAXN];
vector <e> p;

inline void read(int &x)
{
	x=0;char ch=getchar();bool f=false;
	while (ch<'0'||ch>'9'){if (ch=='-') f=true;ch=getchar();}
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	if (f) x=-x;return ;
}

int main()
{
	read(n);read(m);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
			read(a[i][j]);
	for (int i=1;i<=n;i++)
		for (int j=1;j<m;j++)
			if (a[i][j]&1){p.push_back(e(i,j,i,j+1));--a[i][j];++a[i][j+1];}
	for (int i=1;i<n;i++)
		if (a[i][m]&1){p.push_back(e(i,m,i+1,m));--a[i][m];++a[i+1][m];}
	h=p.size();
	printf("%d\n",h);
	for (int i=0;i<h;i++) p[i].print();
	return 0;
}

Submission Info

Submission Time
Task D - Make Them Even
User HeRaNO
Language C++14 (GCC 5.4.1)
Score 400
Code Size 884 Byte
Status AC
Exec Time 39 ms
Memory 5232 KB

Judge Result

Set Name All Sample
Score / Max Score 400 / 400 0 / 0
Status
AC × 29
AC × 3
Set Name Test Cases
All hand_1, hand_2, hand_3, hand_4, hand_5, hand_6, max_1, max_10, max_2, max_3, max_4, max_5, max_6, max_7, max_8, max_9, random_1, random_10, random_2, random_3, random_4, random_5, random_6, random_7, random_8, random_9, sample_01, sample_02, sample_03
Sample sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
hand_1 AC 1 ms 256 KB
hand_2 AC 1 ms 256 KB
hand_3 AC 1 ms 256 KB
hand_4 AC 2 ms 1280 KB
hand_5 AC 38 ms 5104 KB
hand_6 AC 6 ms 1280 KB
max_1 AC 38 ms 5104 KB
max_10 AC 38 ms 5104 KB
max_2 AC 38 ms 5104 KB
max_3 AC 38 ms 5104 KB
max_4 AC 38 ms 5104 KB
max_5 AC 38 ms 5104 KB
max_6 AC 38 ms 5232 KB
max_7 AC 39 ms 5232 KB
max_8 AC 38 ms 5232 KB
max_9 AC 38 ms 5104 KB
random_1 AC 1 ms 384 KB
random_10 AC 6 ms 1148 KB
random_2 AC 9 ms 2040 KB
random_3 AC 13 ms 2292 KB
random_4 AC 5 ms 1020 KB
random_5 AC 7 ms 1528 KB
random_6 AC 16 ms 2676 KB
random_7 AC 12 ms 2040 KB
random_8 AC 15 ms 2292 KB
random_9 AC 22 ms 3316 KB
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sample_03 AC 1 ms 256 KB