Contest Duration: - (local time) (120 minutes)

Submission #2944965

Source Code Expand

Copy
```#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
struct poi{
int X;int Y;int Z;
bool operator<(const poi&R)const{
return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
}
};
//
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;
}
//
int N,M;
char A[2000][2000];
ll a[4][2000][2000];
ll cul(){
FOR(i,0,N){
ROF(j,0,M){
if(A[i][j]=='.'){
int cnt=1;
while(j>=0&&A[i][j]=='.'){
a[0][i][j]=cnt;
j--;
cnt++;
}
j++;
}else{
a[0][i][j]=0;
}
}
}
FOR(j,0,M){
ROF(i,0,N){
if(A[i][j]=='.'){
int cnt=1;
while(i>=0&&A[i][j]=='.'){
a[1][i][j]=cnt;
i--;
cnt++;
}
i++;
}else{
a[1][i][j]=0;
}
}
}
FOR(i,0,N){
FOR(j,0,M){
if(A[i][j]=='.'){
int cnt=1;
while(j<M&&A[i][j]=='.'){
a[2][i][j]=cnt;
j++;
cnt++;
}
j--;
}else{
a[2][i][j]=0;
}
}
}
FOR(j,0,M){
FOR(i,0,N){
if(A[i][j]=='.'){
int cnt=1;
while(i<N&&A[i][j]=='.'){
a[3][i][j]=cnt;
i++;
cnt++;
}
i--;
}else{
a[3][i][j]=0;
}
}
}
}
ll culcul(){
ll ans=0;
FOR(i,0,N){
FOR(j,0,M){
if(A[i][j]=='.'){
ans+=a[0][i][j+1]*a[1][i+1][j];
ans+=a[1][i+1][j]*a[2][i][j-1];
ans+=a[2][i][j-1]*a[3][i-1][j];
ans+=a[3][i-1][j]*a[0][i][j+1];
}
}
}
return ans;
}
int main(){
cin>>N>>M;
FOR(i,0,N){
FOR(j,0,M){
cin>>A[i][j];
}
}
cul();
cout<<culcul()<<endl;
return 0;
}```

Submission Info

Submission Time 2018-08-04 22:19:24+0900 C - 右折 nii C++14 (GCC 5.4.1) 0 1832 Byte WA 364 ms 129152 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
 AC × 3
 AC × 28 WA × 11
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 364 ms 129152 KB
02.txt AC 361 ms 129152 KB
03.txt WA 361 ms 129152 KB
04.txt AC 360 ms 129152 KB
05.txt WA 304 ms 129152 KB
06.txt WA 302 ms 129152 KB
07.txt AC 300 ms 129152 KB
08.txt AC 300 ms 129152 KB
09.txt WA 290 ms 129152 KB
10.txt WA 304 ms 129152 KB
11.txt AC 293 ms 129152 KB
12.txt WA 298 ms 129152 KB
13.txt AC 298 ms 129152 KB
14.txt AC 298 ms 129152 KB
15.txt WA 290 ms 129152 KB
16.txt AC 290 ms 129152 KB
17.txt AC 283 ms 129152 KB
18.txt AC 283 ms 129152 KB
19.txt AC 289 ms 129152 KB
20.txt AC 291 ms 129152 KB
21.txt WA 299 ms 129152 KB
22.txt AC 300 ms 129152 KB
23.txt AC 298 ms 129152 KB
24.txt WA 300 ms 129152 KB
25.txt WA 302 ms 129152 KB
26.txt AC 292 ms 129152 KB
27.txt WA 292 ms 129152 KB
28.txt AC 293 ms 129152 KB
29.txt AC 3 ms 8448 KB
30.txt AC 3 ms 8448 KB
31.txt AC 3 ms 8448 KB
32.txt AC 2 ms 8448 KB
33.txt AC 3 ms 8448 KB
34.txt AC 2 ms 8448 KB
35.txt AC 2 ms 8448 KB
36.txt AC 3 ms 8448 KB
s1.txt AC 2 ms 8448 KB
s2.txt AC 3 ms 8448 KB
s3.txt AC 2 ms 8448 KB