結果

問題 No.5002 stick xor
ユーザー mlpj56dmlpj56d
提出日時 2018-05-26 02:02:47
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,009 bytes
コンパイル時間 2,019 ms
実行使用メモリ 1,504 KB
スコア 0
最終ジャッジ日時 2018-05-26 02:02:51
ジャッジサーバーID
(参考情報)
judge9 /
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<iostream>
using namespace std;

int N,K;
int D[61][61];
int x1,x2,y1,y2;

int check(int a, int b, int c, int d,int e){
    int cnt = 0;
    if( a + b - 1 < N + 1) {
        for(int i=a; i<a+b; i++){
            if( D[c][i] == '1' ) cnt++;
            else cnt--;
        }
        if( cnt > d ){
            e = a;
            d = max( cnt, d);
        }
        check( a+1, b, c, d, e);
    } else {
        if( c >= N ) {
        x1 = e; x2 = b; y1 = c; y2 = c;
        return c,e;
        }
        check( 1, b, c+1, d, e);
    }
}

int main (){
    cin >> N >> K;
    int L[K];
    int score = 0;
    for(int i=0; i<K; i++){
        cin >> L[i];
    }
    for(int i=1; i<=N; i++){
        for(int j=1; j<=N; j++){
            char a;
            cin >> a;
            D[i][j] = a;
            if( a == '0') score++;
        }
    }
    for(int i=0; i<K; i++){
        check(1,L[i],1,0,0);
        cout << y1 << " " << x1 << " " << y2 << " " << x2 << endl;
    }
    return 0;
}
0