# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
627552 | 2022-08-12T16:47:18 Z | Farhan_HY | Strah (COCI18_strah) | C++14 | 1000 ms | 68324 KB |
#include <bits/stdc++.h> #define int long long #define float double #define pb push_back #define F first #define S second #define T int t; cin >> t; while(t--) #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; /// Benzema is the best player in the world const int inf = 8e18; const int N = 2002; const int M = 1e3 + 3; const int LOG = 31; const int mod = 1e9 + 7; const float pi = atan(1) * 4; int n, m, dp[N][N], suf[N][N]; string s[N]; void build() { for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) dp[i][j] += dp[i][j - 1] + i; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) dp[i][j] += dp[i][j - 1]; } main() { IOS cin >> n >> m; for(int i = 1; i <= n; i++) cin >> s[i], s[i] = '.' + s[i]; build(); for(int i = 1; i <= n; i++) { suf[i][m + 1] = m + 1; for(int j = m; j; j--) { suf[i][j] = suf[i][j + 1]; if (s[i][j] == '#') suf[i][j] = j; } } int ans = 0; for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { int k = i; int lst = m + 1; while(suf[k][j] != j && k <= n) { lst = min(lst, suf[k][j]); int y = lst - j; ans += dp[k - i + 1][y]; k++; } } } cout << ans; } ///use scanf
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4308 KB | Output is correct |
2 | Correct | 6 ms | 4336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4308 KB | Output is correct |
2 | Correct | 6 ms | 4308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 4308 KB | Output is correct |
2 | Correct | 6 ms | 4308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 24628 KB | Output is correct |
2 | Correct | 183 ms | 52540 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 73 ms | 44516 KB | Output is correct |
2 | Correct | 220 ms | 68324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 487 ms | 28640 KB | Output is correct |
2 | Correct | 172 ms | 55964 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 19428 KB | Output is correct |
2 | Execution timed out | 1068 ms | 65036 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1092 ms | 67008 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |