結果
問題 | No.421 しろくろチョコレート |
ユーザー | kotamanegi |
提出日時 | 2016-09-09 23:26:07 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,768 bytes |
コンパイル時間 | 1,027 ms |
コンパイル使用メモリ | 92,328 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 18:40:24 |
合計ジャッジ時間 | 2,204 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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 | AC | 1 ms
5,248 KB |
testcase_13 | AC | 2 ms
5,248 KB |
testcase_14 | AC | 1 ms
5,248 KB |
testcase_15 | AC | 1 ms
5,248 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 2 ms
5,248 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 1 ms
5,248 KB |
testcase_24 | AC | 1 ms
5,248 KB |
testcase_25 | AC | 1 ms
5,248 KB |
testcase_26 | AC | 1 ms
5,248 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | AC | 2 ms
5,248 KB |
testcase_63 | WA | - |
testcase_64 | AC | 2 ms
5,248 KB |
ソースコード
#define _CRT_SECURE_NO_WARNINGS #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<map> #include <iomanip> #include <stdlib.h> #include <list> #include <typeinfo> #include <list> #include <set> using namespace std; #define MAX_MOD 1000000007 #define REP(i,n) for(int i = 0;i < n;++i) #define LONGINF 1000000000000000000 int choko[1000][1000] = {}; int already_got[1000][1000] = {}; int moved[4] = { 0,0,-1,1 }; int mmove[4] = { 1,-1,0,0 }; int main() { int n, m; cin >> n >> m; REP(i, n) { string hoge; cin >> hoge; REP(q, m) { if (hoge[q] == 'w') { choko[i+1][q+1] = 1; } else if(hoge[q] == 'b') { choko[i+1][1+q] = 2; } } } for (int i = 1;i <= n;++i) { for (int q = 1;q <= m;++q) { if (choko[i][q] != 0&&already_got[i][q] == false) { queue<pair<pair<int,int>,pair<int,int>>> tmp; for (int j = 0;j < 4;++j) { if (choko[i + mmove[j]][q + moved[j]] != 0&&already_got[i+mmove[j]][q + moved[j]] == 0) { tmp.push(make_pair(make_pair(i + mmove[j], q + moved[j]),make_pair(i,q))); already_got[i + mmove[j]][q+moved[j]] = 1; already_got[i][q] = 1; goto aaa; } } aaa:; while (tmp.empty() == false) { pair<int, int> te = tmp.front().first; pair<int, int> to = tmp.front().second; tmp.pop(); int can_go[2] = {-1,-1}; for (int j = 0;j < 4;++j) { if (choko[te.first + mmove[j]][te.second + moved[j]] != 0&&already_got[te.first + mmove[j]][te.second + moved[j]] == false) { can_go[0] = j; } if (choko[to.first + mmove[j]][to.second + moved[j]] != 0 && already_got[to.first + mmove[j]][to.second + moved[j]] == false) { can_go[1] = j; } } if (can_go[0] != -1 && can_go[1] != -1) { already_got[te.first + mmove[can_go[0]]][te.second + moved[can_go[0]]] = true; already_got[to.first + mmove[can_go[1]]][to.second + moved[can_go[1]]] = true; tmp.push(make_pair(te, make_pair(te.first + mmove[can_go[0]], te.second + moved[can_go[0]]))); tmp.push(make_pair(te, make_pair(to.first + mmove[can_go[1]], to.second + moved[can_go[1]]))); } } } } } int white = 0; int black = 0; int win = 0; for (int i = 0;i <= n + 1;i++) { for (int q = 0;q <= m + 1;++q) { if (already_got[i][q] == 1) { win++; } else { if (choko[i][q] == 1) { white++; } if (choko[i][q] == 2) { black++; } } } } int hoge = white + black; int ans = win * 50; ans += hoge * 5; if (hoge % 2 == 1) { ans -= 4; } cout <<ans << endl; return 0; }