結果

提出番号 1844
提出者 aaabbbcccddd
言語 C++
提出日時 2018-08-04 14:12:33
問題名 (69)机の配置
結果 WA
点数 0%

テストケース

テストケース 結果 得点 実行時間 メモリ使用量
1 AC 100% 2ms 8400KB
2 WA 0% 2ms 8400KB
3 AC 100% 2ms 8192KB
4 WA 0% 2ms 8432KB
5 WA 0% 1ms 8736KB
6 AC 100% 1ms 8336KB
7 AC 100% 2ms 8048KB
8 AC 100% 2ms 8720KB
9 AC 100% 2ms 8416KB
10 WA 0% 2ms 7648KB
11 WA 0% 2ms 8448KB
12 AC 100% 2ms 8448KB
13 AC 100% 1ms 8672KB
14 AC 100% 2ms 8432KB
15 WA 0% 2ms 8016KB
16 WA 0% 2ms 8400KB
17 WA 0% 2ms 8064KB
18 WA 0% 2ms 8192KB
19 AC 100% 2ms 8128KB
20 WA 0% 2ms 8432KB
21 AC 100% 1ms 8272KB
22 WA 0% 2ms 8016KB
23 WA 0% 2ms 8192KB
24 AC 100% 2ms 8416KB
25 WA 0% 2ms 8000KB
26 WA 0% 2ms 8448KB
27 WA 0% 2ms 8448KB
28 AC 100% 2ms 8416KB
29 WA 0% 2ms 7824KB
30 AC 100% 2ms 7232KB

ソースコード

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int N, H, W;
char F[11][11];
vector<int> Ws, Hs;

signed main() {
    cin >> N >> H >> W;
    rep(i, H) {
        rep(j, W) {
            cin >> F[i][j];
        }
    }
    rep(i, H) {
        int num = 0;
        rep(j, W) {
            if (F[i][j] == '.')num++;
            else {
                if (num == 0)continue;
                Ws.push_back(num);
                num = 0;
            }
        }
        if (num == 0)continue;
        Ws.push_back(num);
    }
    rep(i, W) {
        int num = 0;
        rep(j, H) {
            if (F[j][i] == '.')num++;
            else {
                if (num == 0)continue;
                Hs.push_back(num);
                num = 0;
            }
        }
        if (num == 0)continue;
        Hs.push_back(num);
    }
    sort(Hs.begin(), Hs.end());
    sort(Ws.begin(), Ws.end());
    for (int i = 1; i <= N; ++i) {
        int ans1 = 0;
        for (int r = 1; r <= 10; ++r) {
            ans1 += l_b(Hs.begin(), Hs.end(), INF) - l_b(Hs.begin(), Hs.end(), r * i);
        }
        int ans2 = 0;
        for (int r = 1; r <= 10; ++r) {
            ans2 += l_b(Ws.begin(), Ws.end(), INF) - l_b(Ws.begin(), Ws.end(), r * i);
        }
        cout << max(ans1, ans2) << endl;
    }
}