Submission #1574411
Source Code Expand
#include <bits/stdc++.h> #define y1 fvck_y1 using namespace std; inline int read() { int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();} return x*f; } int B1[4010][4010],B2[4010][4010]; char sd[10000]; int n,m,q; int main() { freopen("read.in","r",stdin); n=read(); m=read(); q=read(); for(int i=1;i<=n;i++) { scanf("%s",sd); for(int j=0;j<m;j++) B1[i][j+1]=sd[j]-'0'; } for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(j!=m) B2[i*2-1][j*2]=B1[i][j]&B1[i][j+1]; if(i!=n) B2[i*2][j*2-1]=B1[i][j]&B1[i+1][j]; } } for(int i=1;i<n*2;i++) for(int j=1;j<m*2;j++) B2[i][j]+=B2[i-1][j]+B2[i][j-1]-B2[i-1][j-1]; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) B1[i][j]+=B1[i-1][j]+B1[i][j-1]-B1[i-1][j-1]; for(int i=1;i<=q;i++) { int x1=read(), y1=read(),x2=read(), y2=read(); int X=B1[x2][y2]+B1[x1-1][y1-1]-B1[x1-1][y2]-B1[x2][y1-1]; int Y=B2[x2*2-1][y2*2-1]+B2[x1*2-2][y1*2-2]-B2[x1*2-2][y2*2-1]-B2[x2*2-1][y1*2-2]; printf("%d\n",X-Y); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Nuske vs Phantom Thnook |
User | wcz111 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1128 Byte |
Status | TLE |
Exec Time | 4207 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:18:30: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result] freopen("read.in","r",stdin); ^ ./Main.cpp:22:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s",sd); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | TLE | 4203 ms | 256 KB |
02.txt | TLE | 4203 ms | 256 KB |
03.txt | TLE | 4203 ms | 256 KB |
04.txt | TLE | 4207 ms | 256 KB |
05.txt | TLE | 4203 ms | 256 KB |
06.txt | TLE | 4203 ms | 256 KB |
07.txt | TLE | 4203 ms | 256 KB |
08.txt | TLE | 4203 ms | 256 KB |
09.txt | TLE | 4203 ms | 256 KB |
10.txt | TLE | 4203 ms | 256 KB |
11.txt | TLE | 4203 ms | 256 KB |
12.txt | TLE | 4203 ms | 256 KB |
13.txt | TLE | 4203 ms | 256 KB |
14.txt | TLE | 4203 ms | 256 KB |
15.txt | TLE | 4203 ms | 256 KB |
16.txt | TLE | 4203 ms | 256 KB |
17.txt | TLE | 4203 ms | 256 KB |
18.txt | TLE | 4203 ms | 256 KB |
19.txt | TLE | 4203 ms | 256 KB |
20.txt | TLE | 4203 ms | 256 KB |
21.txt | TLE | 4203 ms | 256 KB |
22.txt | TLE | 4203 ms | 256 KB |
23.txt | TLE | 4203 ms | 256 KB |
24.txt | TLE | 4203 ms | 256 KB |
25.txt | TLE | 4203 ms | 256 KB |
26.txt | TLE | 4203 ms | 256 KB |
27.txt | TLE | 4203 ms | 256 KB |
28.txt | TLE | 4203 ms | 256 KB |
29.txt | TLE | 4203 ms | 256 KB |
30.txt | TLE | 4203 ms | 256 KB |
31.txt | TLE | 4203 ms | 256 KB |
32.txt | TLE | 4203 ms | 256 KB |
33.txt | TLE | 4203 ms | 256 KB |
34.txt | TLE | 4203 ms | 256 KB |
35.txt | TLE | 4203 ms | 256 KB |
36.txt | TLE | 4203 ms | 256 KB |
37.txt | TLE | 4203 ms | 256 KB |
38.txt | TLE | 4203 ms | 256 KB |
39.txt | TLE | 4203 ms | 256 KB |
40.txt | TLE | 4203 ms | 256 KB |
41.txt | TLE | 4203 ms | 256 KB |
42.txt | TLE | 4203 ms | 256 KB |
43.txt | TLE | 4203 ms | 256 KB |
44.txt | TLE | 4203 ms | 256 KB |
45.txt | TLE | 4203 ms | 256 KB |
46.txt | TLE | 4203 ms | 256 KB |
47.txt | TLE | 4203 ms | 256 KB |
48.txt | TLE | 4203 ms | 256 KB |
s1.txt | TLE | 4203 ms | 256 KB |
s2.txt | TLE | 4203 ms | 256 KB |