結果

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

テストケース

テストケース 結果 得点 実行時間 メモリ使用量
1 AC 100% 2ms 8048KB
2 WA 0% 1ms 8352KB
3 AC 100% 1ms 8544KB
4 WA 0% 2ms 7776KB
5 WA 0% 2ms 7632KB
6 AC 100% 2ms 8400KB
7 AC 100% 2ms 7232KB
8 AC 100% 1ms 8656KB
9 AC 100% 2ms 8688KB
10 WA 0% 2ms 8720KB
11 WA 0% 2ms 8064KB
12 AC 100% 2ms 8432KB
13 AC 100% 2ms 8704KB
14 AC 100% 2ms 7216KB
15 WA 0% 2ms 8720KB
16 WA 0% 2ms 8704KB
17 WA 0% 2ms 8416KB
18 WA 0% 1ms 8736KB
19 AC 100% 2ms 8080KB
20 WA 0% 1ms 8400KB
21 AC 100% 1ms 8544KB
22 WA 0% 2ms 7808KB
23 WA 0% 2ms 8432KB
24 AC 100% 2ms 8064KB
25 WA 0% 2ms 8704KB
26 WA 0% 2ms 8624KB
27 WA 0% 2ms 7904KB
28 AC 100% 1ms 7920KB
29 WA 0% 1ms 8112KB
30 AC 100% 1ms 8272KB

ソースコード

#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;
    }
}