답안 #170739

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
170739 2019-12-26T08:56:04 Z BigChungus Strah (COCI18_strah) C++14
55 / 110
121 ms 109616 KB
#include <bits/stdc++.h>

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int N = 306;

string s[N];

int dp[N][N][N];

int main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        cin >> s[i];
        s[i] = '$' + s[i];
    }
    long long ans(0);
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            if (s[i][j] != '#')
                dp[i][j][1] = dp[i - 1][j][1] + 1, ans += 1LL * dp[i][j][1] * (dp[i][j][1] + 1) / 2;
            for (int k = 2; k <= j; ++k)
                if (s[i][j] != '#')
                    dp[i][j][k] = min(dp[i][j - 1][k - 1], dp[i][j][1]), ans += 1LL * dp[i][j][k] * (dp[i][j][k] + 1) / 2 * k;
        }
    }
    cout << ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 113 ms 109020 KB Output is correct
2 Correct 118 ms 109404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 112 ms 109048 KB Output is correct
2 Correct 115 ms 109412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 117 ms 109520 KB Output is correct
2 Correct 121 ms 109616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 1912 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 12 ms 2424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 11 ms 2424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 752 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 10 ms 2552 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -