結果
問題 | No.5002 stick xor |
ユーザー | kotamanegi |
提出日時 | 2018-05-25 23:16:24 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 13 ms / 1,000 ms |
コード長 | 2,192 bytes |
コンパイル時間 | 2,157 ms |
実行使用メモリ | 1,596 KB |
スコア | 1,343 |
最終ジャッジ日時 | 2018-05-25 23:16:28 |
ジャッジサーバーID (参考情報) |
judge8 / |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 12 ms
1,596 KB |
testcase_01 | AC | 12 ms
1,596 KB |
testcase_02 | AC | 12 ms
1,584 KB |
testcase_03 | AC | 12 ms
1,592 KB |
testcase_04 | AC | 12 ms
1,592 KB |
testcase_05 | AC | 12 ms
1,588 KB |
testcase_06 | AC | 12 ms
1,596 KB |
testcase_07 | AC | 13 ms
1,592 KB |
testcase_08 | AC | 12 ms
1,596 KB |
testcase_09 | AC | 13 ms
1,592 KB |
testcase_10 | AC | 11 ms
1,588 KB |
testcase_11 | AC | 12 ms
1,588 KB |
testcase_12 | AC | 12 ms
1,596 KB |
testcase_13 | AC | 12 ms
1,588 KB |
testcase_14 | AC | 12 ms
1,588 KB |
testcase_15 | AC | 13 ms
1,592 KB |
testcase_16 | AC | 12 ms
1,588 KB |
testcase_17 | AC | 13 ms
1,596 KB |
testcase_18 | AC | 12 ms
1,588 KB |
testcase_19 | AC | 12 ms
1,596 KB |
testcase_20 | AC | 12 ms
1,592 KB |
testcase_21 | AC | 12 ms
1,588 KB |
testcase_22 | AC | 13 ms
1,588 KB |
testcase_23 | AC | 12 ms
1,596 KB |
testcase_24 | AC | 13 ms
1,592 KB |
testcase_25 | AC | 12 ms
1,588 KB |
testcase_26 | AC | 12 ms
1,592 KB |
testcase_27 | AC | 13 ms
1,588 KB |
testcase_28 | AC | 12 ms
1,592 KB |
testcase_29 | AC | 12 ms
1,596 KB |
testcase_30 | AC | 13 ms
1,592 KB |
testcase_31 | AC | 12 ms
1,596 KB |
ソースコード
#define _CRT_SECURE_NO_WARNiINGS#include <stdio.h>#include <algorithm>#include <utility>#include <functional>#include <cstring>#include <queue>#include <stack>#include <math.h>#include <iterator>#include <vector>#include <string>#include <set>#include <math.h>#include <iostream>#include <random>#include <map>#include <fstream>#include <iomanip>#include <time.h>#include <stdlib.h>#include <list>#include <typeinfo>#include <list>#include <cassert>#include <set>using namespace std;#define eps 0.000000001#define LONG_INF 10000000000000000#define GOLD 1.61803398874989484820458#define MAX_MOD 1000000007#define REP(i,n) for(long long i = 0;i < n;++i)#define cycle_per_sec 2806192512tuple<int, int, int, int> ans[1000];vector<int> gea[30];int griding[100][100] = {};int main() {int n, k;cin >> n >> k;REP(i, k) {int a;cin >> a;gea[a].push_back(i);}for (int i = 0; i < n; ++i) {string s;cin >> s;for (int q = 0; q < n; ++q) {griding[i][q] = s[q] - '0';}}for (int i = 25; i >= 0; --i) {for (int tew = 0; tew < gea[i].size(); ++tew) {int a, b, c, d;int now_ans = -1000;for (int q = 0; q < n; ++q) {int pre_ans = 0;for (int j = 0; j < n; ++j) {if (griding[q][j] == 0) pre_ans--;else pre_ans++;if (j >= i) {if (griding[q][j - i] == 0) pre_ans++;else pre_ans--;}if (j+1 >= i) {if (pre_ans > now_ans) {now_ans = pre_ans;a = q;b = j - i + 1;c = q;d = j;}}}}for (int q = 0; q < n; ++q) {int pre_ans = 0;for (int j = 0; j < n; ++j) {if (griding[j][q] == 0) pre_ans--;else pre_ans++;if (j >= i) {if (griding[j - i][q] == 0) pre_ans++;else pre_ans--;}if (j + 1 >= i) {if (pre_ans > now_ans) {now_ans = pre_ans;a = j - i + 1;b = q;c = j;d = q;}}}}ans[gea[i][tew]] = make_tuple(a, b, c, d);}}for (int i = 0; i < k; ++i) {cout << get<0>(ans[i])+1 << " " << get<1>(ans[i])+1 << " " << get<2>(ans[i])+1 << " " << get<3>(ans[i])+1 << endl;}return 0;}