Submission #1574413
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 | 700 |
Code Size | 1130 Byte |
Status | AC |
Exec Time | 179 ms |
Memory | 96000 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./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 | 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, 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 | AC | 158 ms | 95616 KB |
02.txt | AC | 179 ms | 95488 KB |
03.txt | AC | 150 ms | 95616 KB |
04.txt | AC | 174 ms | 95360 KB |
05.txt | AC | 150 ms | 95744 KB |
06.txt | AC | 174 ms | 95488 KB |
07.txt | AC | 145 ms | 95360 KB |
08.txt | AC | 170 ms | 94208 KB |
09.txt | AC | 139 ms | 94336 KB |
10.txt | AC | 177 ms | 95360 KB |
11.txt | AC | 151 ms | 95616 KB |
12.txt | AC | 96 ms | 56192 KB |
13.txt | AC | 54 ms | 75520 KB |
14.txt | AC | 41 ms | 3328 KB |
15.txt | AC | 30 ms | 2688 KB |
16.txt | AC | 40 ms | 2944 KB |
17.txt | AC | 53 ms | 75392 KB |
18.txt | AC | 58 ms | 75008 KB |
19.txt | AC | 37 ms | 3072 KB |
20.txt | AC | 159 ms | 87680 KB |
21.txt | AC | 148 ms | 94976 KB |
22.txt | AC | 176 ms | 95360 KB |
23.txt | AC | 46 ms | 13952 KB |
24.txt | AC | 174 ms | 95360 KB |
25.txt | AC | 30 ms | 2688 KB |
26.txt | AC | 41 ms | 7552 KB |
27.txt | AC | 37 ms | 2944 KB |
28.txt | AC | 58 ms | 75008 KB |
29.txt | AC | 56 ms | 75392 KB |
30.txt | AC | 40 ms | 3072 KB |
31.txt | AC | 150 ms | 96000 KB |
32.txt | AC | 178 ms | 95744 KB |
33.txt | AC | 149 ms | 95360 KB |
34.txt | AC | 177 ms | 95616 KB |
35.txt | AC | 148 ms | 95232 KB |
36.txt | AC | 172 ms | 95104 KB |
37.txt | AC | 149 ms | 95232 KB |
38.txt | AC | 173 ms | 95104 KB |
39.txt | AC | 155 ms | 95872 KB |
40.txt | AC | 175 ms | 95616 KB |
41.txt | AC | 149 ms | 95360 KB |
42.txt | AC | 176 ms | 95232 KB |
43.txt | AC | 148 ms | 94848 KB |
44.txt | AC | 172 ms | 94976 KB |
45.txt | AC | 1 ms | 2304 KB |
46.txt | AC | 1 ms | 2304 KB |
47.txt | AC | 1 ms | 2304 KB |
48.txt | AC | 2 ms | 2304 KB |
s1.txt | AC | 2 ms | 2304 KB |
s2.txt | AC | 2 ms | 2304 KB |