Submission #3592621
Source Code Expand
#include <bits/stdc++.h> using namespace std; using ll=long long; const int N=305; int n, m, s[3*N][3*N], t[3*N][3*N]; char b[3*N][3*N]; ll r; int main(){ scanf("%d%d", &n, &m); for(int i=0; i<n; i++) scanf("%s", b[i+N]+N); for(int i=0; i<6*N; i++) for(int x=i, y=0; y<3*N; x--, y++) if(0<=x&&x<3*N-1) s[x][y]=s[x+1][y-1]+(b[x][y]=='#'); for(int i=-3*N; i<3*N; i++) for(int x=i, y=0; y<3*N; x++, y++) if(0<x&&x<3*N) t[x][y]=t[x-1][y-1]+(b[x][y]=='#'); for(int i=N; i<=N+n+m-2; i++) for(int x=i, y=N; y<N+m; x--, y++) for(int z=x-1, w=y+1; w<N+m; z--, w++) if(b[x][y]=='#'&&b[z][w]=='#'){ int u=w-y; r+=s[x][w+u]-s[x+u][w]+s[z-u+1][y-1]-s[z+1][y-u-1]; } for(int i=N-m+1; i<=N+n-1; i++) for(int x=i, y=N; y<N+m; x++, y++) for(int z=x+1, w=y+1; w<N+m; z++, w++) if(b[x][y]=='#'&&b[z][w]=='#'){ int u=w-y; r+=t[z+u][y]-t[z][y-u]+t[x-1][w+u-1]-t[x-u-1][w-1]; } printf("%lld\n", r); return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Equilateral |
User | kdh9949 |
Language | C++14 (GCC 5.4.1) |
Score | 700 |
Code Size | 1040 Byte |
Status | AC |
Exec Time | 160 ms |
Memory | 7168 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:13:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d", &n, &m); ^ ./Main.cpp:14:49: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for(int i=0; i<n; i++) scanf("%s", b[i+N]+N); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 700 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.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, 37.txt, 38.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 93 ms | 7040 KB |
02.txt | AC | 92 ms | 7040 KB |
03.txt | AC | 92 ms | 7040 KB |
04.txt | AC | 94 ms | 7040 KB |
05.txt | AC | 92 ms | 7040 KB |
06.txt | AC | 92 ms | 7040 KB |
07.txt | AC | 91 ms | 7040 KB |
08.txt | AC | 100 ms | 7040 KB |
09.txt | AC | 57 ms | 7040 KB |
10.txt | AC | 56 ms | 7040 KB |
11.txt | AC | 56 ms | 7040 KB |
12.txt | AC | 57 ms | 7040 KB |
13.txt | AC | 57 ms | 7168 KB |
14.txt | AC | 56 ms | 7040 KB |
15.txt | AC | 144 ms | 7040 KB |
16.txt | AC | 146 ms | 7040 KB |
17.txt | AC | 144 ms | 7040 KB |
18.txt | AC | 145 ms | 7040 KB |
19.txt | AC | 143 ms | 7040 KB |
20.txt | AC | 146 ms | 7040 KB |
21.txt | AC | 160 ms | 7040 KB |
22.txt | AC | 158 ms | 7040 KB |
23.txt | AC | 51 ms | 7040 KB |
24.txt | AC | 52 ms | 7040 KB |
25.txt | AC | 106 ms | 7040 KB |
26.txt | AC | 105 ms | 7040 KB |
27.txt | AC | 30 ms | 6784 KB |
28.txt | AC | 30 ms | 6784 KB |
29.txt | AC | 10 ms | 7040 KB |
30.txt | AC | 10 ms | 7040 KB |
31.txt | AC | 30 ms | 6784 KB |
32.txt | AC | 30 ms | 6784 KB |
33.txt | AC | 10 ms | 7040 KB |
34.txt | AC | 10 ms | 7040 KB |
35.txt | AC | 9 ms | 6784 KB |
36.txt | AC | 9 ms | 6784 KB |
37.txt | AC | 9 ms | 6784 KB |
38.txt | AC | 9 ms | 6784 KB |
s1.txt | AC | 9 ms | 6784 KB |
s2.txt | AC | 9 ms | 6784 KB |