# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
464689 | 2021-08-13T17:01:44 Z | aihay | Strah (COCI18_strah) | C++14 | 4 ms | 468 KB |
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize("-Ofast") #include <bits/stdc++.h> using namespace std; typedef int in; //#define int long long #define f first #define s second #define pb push_back #define pp push #define double long double #define ceil(x,y) (x/y)+(x%y!=0)*((double)(1.0*x/y)<0?0:1) #define floor(x,y) (x/y)+(x%y!=0)*((double)(1.0a*x/y)<0?-1:0) const int MAX=1e7; const int MOD=1e9+7; const int MAAX=1e18; int n,m,csum[310],arr[310],x,y; long long ans; string s[310]; stack<int> st; in main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int tc=1; //cin>>tc; while(tc--){ cin>>n>>m; for(int i=0;i<n;i++){ cin>>s[i]; for(int j=0;j<m;j++){ if(s[i][j]=='.') csum[j]=csum[j]+1; else csum[j]=0; } for(int j=0;j<m;j++){ while(st.size()&&csum[j]<csum[st.top()]){ arr[st.top()]=j-1; st.pop(); } st.pp(j); } while(st.size()){ arr[st.top()]=m-1; st.pop(); } for(int j=0;j<m;j++){ x=j,y=arr[j]; while(x&&csum[x-1]>csum[j]){ x--; } ans+=((y-j+1ll)*(y-j+2ll)/2ll*(j-x+1ll)+(j-x+1ll)*(j-x)/2ll*(y-j+1ll))*((csum[j]*(csum[j]+1ll))/2ll); } } cout<<ans<<endl; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 408 KB | Output is correct |
2 | Correct | 4 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 332 KB | Output is correct |
2 | Correct | 4 ms | 460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 3 ms | 460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |