Submission #197854

#TimeUsernameProblemLanguageResultExecution timeMemory
197854triplem5dsStrah (COCI18_strah)C++14
55 / 110
1082 ms23960 KiB
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include "bits/stdc++.h" using namespace std; #define pb push_back #define F first #define S second #define f(i,a,b) for(int i = a; i < b; i++) #define endl '\n' using ll = long long; using db = long double; using ii = pair<int, int>; const int N = 1e5 + 5, LG = 19, MOD = 1e9 + 7; const int SQ =320; const long double EPS = 1e-7; char g[2005][2005]; int a[2005][2005]; int n, m; int32_t main(){ #ifdef ONLINE_JUDGE ios_base::sync_with_stdio(0); cin.tie(0); #endif cin >> n >> m; f(i,0,n) f(j,0,m) cin >> g[i][j]; for(int i = n - 1; i >= 0; --i){ f(j,0,m){ if(g[i][j] == '.')a[i][j] = a[i+1][j] + 1; } } ll sum = 0; f(i,0,n){ stack<int> stk; f(j,0,m){ int mn = INT_MAX; f(k,j,m){ mn = min(mn, a[i][k]); sum += mn * (mn + 1) / 2 * (k-j+1); } } } cout << sum << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...