Submission #4049068


Source Code Expand

#include <bits/stdc++.h>

#define rep(i,m,n) for(int i = (m); i < (n); i++)
#define rrep(i,m,n) for(int i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]); if(i!=n-1) cout << " ";} cout << endl;
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H,W;
    cin >> H >> W;
    ll a[510][510];
    rep(i,0,H){
        rep(j,0,W){
            cin >> a[i][j];
        }
    }
    ll ans[300010][4] = {};
    ll cnt = 0;
    rep(i,0,H){
        rep(j,0,W-1){
            if(a[i][j] % 2 == 1){
                ans[cnt][0] = i+1; ans[cnt][1] = j+1; ans[cnt][2] = i+1; ans[cnt][3] = j+2;
                a[i][j]--;
                a[i][j+1]++;
                cnt++;
            }
        }
    }
    rep(j,0,W){
        rep(i,0,H-1){
            if(a[i][j] % 2 == 1){
                ans[cnt][0] = i+1; ans[cnt][1] = j+1; ans[cnt][2] = i+2; ans[cnt][3] = j+1;
                a[i][j]--;
                a[i+1][j]++;
                cnt++;
            }

        }
    }
    print(cnt);
    rep(i,0,cnt){
        rep(j,0,4){
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}

Submission Info

Submission Time
Task D - Make Them Even
User yuji9511
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1532 Byte
Status WA
Exec Time 239 ms
Memory 13696 KB

Judge Result

Set Name All Sample
Score / Max Score 0 / 400 0 / 0
Status
AC × 3
WA × 26
WA × 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 4 ms 11136 KB
hand_2 AC 4 ms 10496 KB
hand_3 WA 4 ms 10112 KB
hand_4 WA 5 ms 11648 KB
hand_5 WA 233 ms 13696 KB
hand_6 AC 19 ms 11648 KB
max_1 WA 238 ms 13568 KB
max_10 WA 236 ms 13696 KB
max_2 WA 236 ms 13696 KB
max_3 WA 236 ms 13568 KB
max_4 WA 233 ms 13696 KB
max_5 WA 235 ms 13696 KB
max_6 WA 239 ms 13696 KB
max_7 WA 235 ms 13696 KB
max_8 WA 237 ms 13696 KB
max_9 WA 236 ms 13696 KB
random_1 WA 5 ms 10112 KB
random_10 WA 35 ms 10752 KB
random_2 WA 52 ms 12032 KB
random_3 WA 77 ms 12288 KB
random_4 WA 27 ms 11776 KB
random_5 WA 43 ms 11776 KB
random_6 WA 96 ms 12416 KB
random_7 WA 69 ms 12032 KB
random_8 WA 87 ms 12288 KB
random_9 WA 131 ms 12672 KB
sample_01 WA 4 ms 11520 KB
sample_02 WA 4 ms 10496 KB
sample_03 WA 4 ms 10496 KB