Submission #68824443
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define rep(i, s, t) for(int i = (s); i <= (t); i ++) #define per(i, s, t) for(int i = (s); i >= (t); i --) template<typename T, typename T2> inline void chmin(T &x, T2 &&y) { x = min(x, y); } template<typename T, typename T2> inline void chmax(T &x, T2 &&y) { x = max(x, y); } typedef long long ll; const int N = 5e5 + 5; int n, m, k; vector<ll> w[N]; string s[N]; int h[N], l[N], r[N]; signed main() { ios::sync_with_stdio(0);cin.tie(0); cin >> n >> m >> k; rep(i, 1, n) cin >> s[i], s[i] = ' ' + s[i]; rep(i, 0, n) w[i].resize(m + 2); rep(i, 1, n) { w[i][1] = min(i, k); rep(j, 2, m) w[i][j] = 2 * w[i][j - 1] - w[i][j - 2] + min(i, k / j); } ll ans = 0; rep(i, 1, n) { rep(j, 1, m) h[j] = s[i][j] == '.' ? h[j] + 1 : 0; stack<int> s; rep(j, 1, m) { while (s.size() && h[s.top()] > h[j]) s.pop(); l[j] = s.size() ? s.top() + 1 : 1; s.push(j); } s = {}; per(j, m, 1) { while (s.size() && h[s.top()] >= h[j]) s.pop(); r[j] = s.size() ? s.top() - 1 : m; s.push(j); } s = {}; rep(j, 1, m) ans += w[h[j]][r[j] - l[j] + 1] - w[h[j]][j - l[j]] - w[h[j]][r[j] - j]; } cout << ans; return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - kirinuki |
User | adam01 |
Language | C++ 20 (gcc 12.2) |
Score | 550 |
Code Size | 1406 Byte |
Status | AC |
Exec Time | 190 ms |
Memory | 85716 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 550 / 550 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt, test_61.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
hand_01.txt | AC | 96 ms | 63412 KiB |
hand_02.txt | AC | 89 ms | 63464 KiB |
hand_03.txt | AC | 91 ms | 63464 KiB |
hand_04.txt | AC | 94 ms | 63272 KiB |
hand_05.txt | AC | 97 ms | 63280 KiB |
hand_06.txt | AC | 88 ms | 63364 KiB |
hand_07.txt | AC | 89 ms | 63424 KiB |
hand_08.txt | AC | 91 ms | 63352 KiB |
sample_01.txt | AC | 9 ms | 19156 KiB |
sample_02.txt | AC | 9 ms | 19088 KiB |
sample_03.txt | AC | 9 ms | 19140 KiB |
test_01.txt | AC | 9 ms | 19040 KiB |
test_02.txt | AC | 10 ms | 19204 KiB |
test_03.txt | AC | 92 ms | 74592 KiB |
test_04.txt | AC | 88 ms | 63320 KiB |
test_05.txt | AC | 162 ms | 85452 KiB |
test_06.txt | AC | 97 ms | 66964 KiB |
test_07.txt | AC | 97 ms | 63284 KiB |
test_08.txt | AC | 101 ms | 63152 KiB |
test_09.txt | AC | 141 ms | 70944 KiB |
test_10.txt | AC | 103 ms | 63756 KiB |
test_11.txt | AC | 103 ms | 63332 KiB |
test_12.txt | AC | 97 ms | 65820 KiB |
test_13.txt | AC | 125 ms | 63260 KiB |
test_14.txt | AC | 133 ms | 63320 KiB |
test_15.txt | AC | 148 ms | 83580 KiB |
test_16.txt | AC | 108 ms | 63716 KiB |
test_17.txt | AC | 118 ms | 63432 KiB |
test_18.txt | AC | 147 ms | 65252 KiB |
test_19.txt | AC | 123 ms | 64416 KiB |
test_20.txt | AC | 111 ms | 63312 KiB |
test_21.txt | AC | 173 ms | 81272 KiB |
test_22.txt | AC | 158 ms | 64448 KiB |
test_23.txt | AC | 95 ms | 63344 KiB |
test_24.txt | AC | 91 ms | 73288 KiB |
test_25.txt | AC | 91 ms | 63688 KiB |
test_26.txt | AC | 88 ms | 63188 KiB |
test_27.txt | AC | 111 ms | 70948 KiB |
test_28.txt | AC | 89 ms | 63996 KiB |
test_29.txt | AC | 87 ms | 63316 KiB |
test_30.txt | AC | 96 ms | 65236 KiB |
test_31.txt | AC | 96 ms | 64116 KiB |
test_32.txt | AC | 99 ms | 63228 KiB |
test_33.txt | AC | 145 ms | 70900 KiB |
test_34.txt | AC | 110 ms | 63384 KiB |
test_35.txt | AC | 103 ms | 63324 KiB |
test_36.txt | AC | 99 ms | 65800 KiB |
test_37.txt | AC | 144 ms | 63432 KiB |
test_38.txt | AC | 127 ms | 63192 KiB |
test_39.txt | AC | 148 ms | 77712 KiB |
test_40.txt | AC | 121 ms | 66132 KiB |
test_41.txt | AC | 115 ms | 63352 KiB |
test_42.txt | AC | 161 ms | 65644 KiB |
test_43.txt | AC | 115 ms | 63324 KiB |
test_44.txt | AC | 159 ms | 63200 KiB |
test_45.txt | AC | 190 ms | 81288 KiB |
test_46.txt | AC | 118 ms | 63532 KiB |
test_47.txt | AC | 162 ms | 63068 KiB |
test_48.txt | AC | 88 ms | 67036 KiB |
test_49.txt | AC | 90 ms | 63436 KiB |
test_50.txt | AC | 87 ms | 63332 KiB |
test_51.txt | AC | 146 ms | 85716 KiB |
test_52.txt | AC | 93 ms | 63112 KiB |
test_53.txt | AC | 88 ms | 63384 KiB |
test_54.txt | AC | 105 ms | 63340 KiB |
test_55.txt | AC | 89 ms | 63268 KiB |
test_56.txt | AC | 109 ms | 63056 KiB |
test_57.txt | AC | 93 ms | 63348 KiB |
test_58.txt | AC | 106 ms | 63240 KiB |
test_59.txt | AC | 87 ms | 63408 KiB |
test_60.txt | AC | 106 ms | 63404 KiB |
test_61.txt | AC | 92 ms | 63264 KiB |