# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
313526 |
2020-10-16T07:48:46 Z |
PixelCat |
Strah (COCI18_strah) |
C++14 |
|
1000 ms |
39928 KB |
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<ll,ll>;
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
#define F first
#define S second
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define bpc __builtin_popcount
#define MOD (ll)(1e9)
#define INF (1e18)
#define EPS (1e-6)
#define NATHANLEE_IS_EVIL_AND_ELECTRIC true
#define int ll
#ifdef LOCAL_TEST
#define debug(...) do{\
cerr<<__PRETTY_FUNCTION__<<" - "<<__LINE__<<\
" : ("#__VA_ARGS__<<") = ";\
_OUT(__VA_ARGS__);\
}while(0)
template<typename T>void _OUT(T x){cerr<<x<<"\n";}
template<typename T,typename...I>void _OUT(T x,I ...tail){cerr<<x<<", ";_OUT(tail...);}
#else
#define debug(...)
#endif
void INIT(){
#ifdef LOCAL_TEST
freopen("D:\\input.in","r",stdin);
freopen("D:\\output.out","w",stdout);
freopen("D:\\error.out","w",stderr);
#endif
ios::sync_with_stdio(!NATHANLEE_IS_EVIL_AND_ELECTRIC);
cin.tie(0);
}
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll fpow(ll b,ll p){
b%=MOD;
ll ans=1;
while(p>0){
if(p&1) ans=(ans*b)%MOD;
p/=2;
b=(b*b)%MOD;
}
return ans;
}
int32_t main() {
INIT();
//code...
int n,m; cin>>n>>m;
vector<string> g(n);
vector<vector<int>> h(n);
for(auto &i:g) cin>>i;
for(auto &i:h) i.resize(m);
For(j,0,m-1){
For(i,0,n-1){
if(g[i][j]=='#') h[i][j]=0;
else if(i==0) h[i][j]=1;
else h[i][j]=h[i-1][j]+1;
}
}
int ans=0;
For(i,0,n-1) For(j,0,m-1){
int now=INF;
Forr(k,j,0){
now=min(now,h[i][k]);
ans+=(now*(now+1)/2)*(j-k+1);
//cout<<i<<j<<k<<now<<"\n";
}
}
cout<<ans<<"\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1280 KB |
Output is correct |
2 |
Correct |
29 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1280 KB |
Output is correct |
2 |
Correct |
29 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
1400 KB |
Output is correct |
2 |
Correct |
27 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
10624 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1052 ms |
24704 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
15744 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
3192 KB |
Output is correct |
2 |
Execution timed out |
1096 ms |
29440 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
39928 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |