結果
問題 | No.866 レベルKの正方形 |
ユーザー | 👑 jupiro |
提出日時 | 2020-01-31 02:53:26 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,618 bytes |
コンパイル時間 | 1,092 ms |
コンパイル使用メモリ | 117,012 KB |
実行使用メモリ | 415,652 KB |
最終ジャッジ日時 | 2023-10-14 13:48:19 |
合計ジャッジ時間 | 40,216 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,508 KB |
testcase_01 | AC | 2 ms
5,592 KB |
testcase_02 | AC | 2 ms
5,536 KB |
testcase_03 | AC | 2 ms
5,536 KB |
testcase_04 | AC | 2 ms
5,672 KB |
testcase_05 | AC | 2 ms
5,500 KB |
testcase_06 | AC | 2 ms
5,532 KB |
testcase_07 | AC | 2 ms
5,504 KB |
testcase_08 | AC | 3,131 ms
415,392 KB |
testcase_09 | AC | 2,426 ms
415,328 KB |
testcase_10 | AC | 2,228 ms
415,308 KB |
testcase_11 | AC | 2,872 ms
415,396 KB |
testcase_12 | AC | 2,504 ms
415,400 KB |
testcase_13 | AC | 2,956 ms
415,332 KB |
testcase_14 | WA | - |
testcase_15 | AC | 2,817 ms
415,352 KB |
testcase_16 | AC | 2,693 ms
415,620 KB |
testcase_17 | AC | 2,533 ms
415,420 KB |
testcase_18 | AC | 2,851 ms
415,612 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 1,593 ms
415,392 KB |
testcase_22 | AC | 2 ms
4,348 KB |
testcase_23 | AC | 1 ms
4,348 KB |
testcase_24 | AC | 3 ms
7,876 KB |
ソースコード
#include <cstdio> #include <iostream> #include <string> #include <sstream> #include <stack> #include <algorithm> #include <cmath> #include <queue> #include <map> #include <set> #include <cstdlib> #include <bitset> #include <tuple> #include <assert.h> #include <deque> #include <bitset> #include <iomanip> #include <limits> #include <chrono> #include <random> #include <array> #include <unordered_map> #include <functional> #include <complex> template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long MAX = 5100000; const long long INF = 1LL << 60; //const long long mod = 1000000007LL; //const long long mod = 998244353LL; using namespace std; typedef unsigned long long ull; typedef long long ll; int dp[2007][2007][26]; string vs[2007]; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll H, W, K; cin >> H >> W >> K; for (ll i = 0; i < H; i++) { cin >> vs[i]; } for (ll i = 0; i <= H; i++)for (ll j = 0; j <= W; j++)for (ll k = 0; k < 26; k++) dp[i][j][k] = (1 << 30); for (ll k = 0; k < 26; k++) { for (ll i = H - 1; i >= 0; i--) { for (ll j = W - 1; j >= 0; j--) { int f = min(H - i, W - j); if (vs[i][j] - 'a' == k) dp[i][j][k] = 1; else dp[i][j][k] = min({ f,dp[i + 1][j][k],dp[i][j + 1][k],dp[i + 1][j + 1][k] }) + 1; } } } ll res = 0; for (ll i = 0; i < H; i++) { for (ll j = 0; j < W; j++) { sort(dp[i][j], dp[i][j] + 26); res += dp[i][j][K] - dp[i][j][K - 1]; } } cout << res << endl; return 0; }