Submission #3738205
Source Code Expand
import numpy as np (n, m, q) = list(map(int, input().split())) mapa = [[0 for _ in range(m + 1)]] + [[0] + list(map(int, list(input()))) for _ in range(n)] mapa = np.array(mapa) mapa_h = np.cumsum(np.cumsum(mapa[:n,:] * mapa[1:,:], axis=0), axis=1) mapa_w = np.cumsum(np.cumsum(mapa[:,:m] * mapa[:, 1:], axis=0), axis=1) mapa = np.cumsum(np.cumsum(mapa, axis=0), axis=1) for _ in range(q): (x1, y1, x2, y2) = list(map(int, input().split())) count = mapa[x2][y2] - mapa[x1 - 1][y2] - mapa[x2][y1 - 1] + mapa[x1 - 1][y1 - 1] count -= mapa_h[x2-1][y2] - mapa_h[x1-1][y2] - mapa_h[x2-1][y1-1] + mapa_h[x1-1][y1-1] count -= mapa_w[x2][y2-1] - mapa_w[x1-1][y2-1] - mapa_w[x2][y1-1] + mapa_w[x1-1][y1-1] print(count)
Submission Info
Submission Time | |
---|---|
Task | C - Nuske vs Phantom Thnook |
User | mashinosatoshi |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 743 Byte |
Status | TLE |
Exec Time | 4222 ms |
Memory | 186352 KB |
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 | 4209 ms | 179632 KB |
02.txt | TLE | 4210 ms | 181412 KB |
03.txt | TLE | 4210 ms | 179500 KB |
04.txt | TLE | 4209 ms | 181608 KB |
05.txt | TLE | 4210 ms | 186316 KB |
06.txt | TLE | 4209 ms | 184404 KB |
07.txt | TLE | 4210 ms | 177504 KB |
08.txt | TLE | 4210 ms | 179916 KB |
09.txt | TLE | 4209 ms | 160580 KB |
10.txt | TLE | 4222 ms | 184272 KB |
11.txt | TLE | 4209 ms | 186352 KB |
12.txt | TLE | 4205 ms | 68376 KB |
13.txt | TLE | 4208 ms | 15976 KB |
14.txt | TLE | 4208 ms | 13800 KB |
15.txt | TLE | 4208 ms | 12776 KB |
16.txt | TLE | 4208 ms | 14824 KB |
17.txt | TLE | 4208 ms | 13288 KB |
18.txt | TLE | 4208 ms | 14824 KB |
19.txt | TLE | 4208 ms | 13200 KB |
20.txt | TLE | 4210 ms | 170700 KB |
21.txt | TLE | 4209 ms | 186316 KB |
22.txt | TLE | 4209 ms | 169972 KB |
23.txt | TLE | 4208 ms | 16308 KB |
24.txt | TLE | 4210 ms | 186312 KB |
25.txt | TLE | 4208 ms | 12776 KB |
26.txt | TLE | 4208 ms | 14952 KB |
27.txt | TLE | 4208 ms | 13032 KB |
28.txt | TLE | 4208 ms | 14824 KB |
29.txt | TLE | 4208 ms | 13416 KB |
30.txt | TLE | 4208 ms | 13288 KB |
31.txt | TLE | 4209 ms | 179632 KB |
32.txt | TLE | 4210 ms | 186188 KB |
33.txt | TLE | 4209 ms | 184280 KB |
34.txt | TLE | 4210 ms | 186312 KB |
35.txt | TLE | 4210 ms | 184272 KB |
36.txt | TLE | 4209 ms | 184272 KB |
37.txt | TLE | 4210 ms | 184272 KB |
38.txt | TLE | 4209 ms | 186316 KB |
39.txt | TLE | 4210 ms | 186316 KB |
40.txt | TLE | 4210 ms | 179628 KB |
41.txt | TLE | 4210 ms | 186316 KB |
42.txt | TLE | 4210 ms | 184272 KB |
43.txt | TLE | 4209 ms | 184276 KB |
44.txt | TLE | 4210 ms | 184276 KB |
45.txt | AC | 150 ms | 12520 KB |
46.txt | AC | 149 ms | 12408 KB |
47.txt | AC | 152 ms | 12408 KB |
48.txt | AC | 148 ms | 12408 KB |
s1.txt | AC | 147 ms | 12408 KB |
s2.txt | AC | 147 ms | 12408 KB |