Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B"You are given an n xe2 x80 x89 xc3 x97 xe2 x80 x89m grid, some of its nodes are black, the others are white. Moreover, it's not an ordinary grid -- each unit square of the grid has painted diagonals. The figure below is an example of such grid of size 3 xe2 x80 x89 xc3 x97 xe2 x80 x895. Four nodes of this grid are black, the other 11 nodes are white. Your task is to count the number of such triangles on the given grid that: The first line contains two integers n and m (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89400). Each of the following n lines contain m characters (zeros and ones) -- the description of the grid. If the j-th character in the i-th line equals zero, then the node on the i-th horizontal line and on the j-th vertical line is painted white. Otherwise, the node is painted black. The horizontal lines are numbered starting from one from top to bottom, the vertical lines are numbered starting from one from left to right. Print a single integer -- the number of required triangles. The figure below shows red and blue triangles. They are the examples of the required triangles in the first sample. One of the invalid triangles is painted green. It is invalid because not all sides go along the grid lines."... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
7854712 |
ongvuacon |
D |
Sept. 19, 2014, 2:41 p.m. |
OK |
FPC |
TESTS |
43 |
420 |
16076800 |
|
2200 |
12293800 |
igdor99 |
D |
July 31, 2015, 3:52 p.m. |
OK |
FPC |
TESTS |
43 |
639 |
3481600 |
|
2200 |
6760348 |
chicken_coder |
D |
June 1, 2014, 3:39 a.m. |
OK |
FPC |
TESTS |
43 |
717 |
2764800 |
|
2200 |
35682576 |
DonaldJTrump |
D |
Feb. 25, 2018, 2:09 p.m. |
OK |
FPC |
TESTS |
43 |
717 |
5324800 |
|
2200 |
6760336 |
chicken_coder |
D |
June 1, 2014, 3:33 a.m. |
OK |
FPC |
TESTS |
43 |
748 |
2764800 |
|
2200 |
7104201 |
WARenie |
D |
July 14, 2014, 10:48 p.m. |
OK |
FPC |
TESTS |
43 |
936 |
2560000 |
|
2200 |
6763467 |
vuonghy2442 |
D |
June 1, 2014, 9:38 a.m. |
OK |
FPC |
TESTS |
43 |
951 |
5324800 |
|
2200 |
9147639 |
ljz |
D |
Dec. 16, 2014, 2:47 a.m. |
OK |
FPC |
TESTS |
43 |
1107 |
2867200 |
|
2200 |
6783099 |
WARenie |
D |
June 2, 2014, 4:32 p.m. |
OK |
FPC |
TESTS |
43 |
1387 |
2560000 |
|
2200 |
6749953 |
xrz199721 |
D |
May 30, 2014, 5:05 p.m. |
OK |
FPC |
TESTS |
43 |
3135 |
5017600 |
|
2200 |
6749498 |
EKASMA |
D |
May 30, 2014, 4:56 p.m. |
OK |
GNU C |
TESTS |
43 |
202 |
6553600 |
|
2200 |
6752335 |
sgtlaugh |
D |
May 30, 2014, 6:35 p.m. |
OK |
GNU C |
TESTS |
43 |
343 |
4403200 |
|
2200 |
6752415 |
nikola12345 |
D |
May 30, 2014, 6:46 p.m. |
OK |
GNU C++ |
TESTS |
43 |
139 |
6041600 |
|
2200 |
6749424 |
Melnyk |
D |
May 30, 2014, 4:55 p.m. |
OK |
GNU C++ |
TESTS |
43 |
140 |
3072000 |
|
2200 |
40988618 |
ReaLNero1 |
D |
July 30, 2018, 10:12 p.m. |
OK |
GNU C++ |
TESTS |
43 |
140 |
5836800 |
|
2200 |
9668308 |
dredwerkz |
D |
Feb. 1, 2015, 5:46 p.m. |
OK |
GNU C++ |
TESTS |
43 |
171 |
2662400 |
|
2200 |
19414135 |
HanHansoul |
D |
July 26, 2016, 3:46 a.m. |
OK |
GNU C++ |
TESTS |
43 |
171 |
2867200 |
|
2200 |
6823862 |
qqz003 |
D |
June 6, 2014, 2:50 a.m. |
OK |
GNU C++ |
TESTS |
43 |
202 |
2867200 |
|
2200 |
6757318 |
BogdanFlorea |
D |
May 31, 2014, 1:15 p.m. |
OK |
GNU C++ |
TESTS |
43 |
217 |
3276800 |
|
2200 |
9001573 |
aarshee |
D |
Dec. 6, 2014, 2:16 p.m. |
OK |
GNU C++ |
TESTS |
43 |
218 |
8294400 |
|
2200 |
6748916 |
netman |
D |
May 30, 2014, 4:46 p.m. |
OK |
GNU C++ |
TESTS |
43 |
249 |
2764800 |
|
2200 |
6815259 |
zyb |
D |
June 5, 2014, 12:41 a.m. |
OK |
GNU C++ |
TESTS |
43 |
249 |
5836800 |
|
2200 |
6747182 |
Xellos |
D |
May 30, 2014, 4:20 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
171 |
5836800 |
|
2200 |
9423461 |
Kira96 |
D |
Jan. 13, 2015, 12:57 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
187 |
5836800 |
|
2200 |
6749699 |
pmnox |
D |
May 30, 2014, 4:59 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
187 |
6553600 |
|
2200 |
6780787 |
qpalz |
D |
June 2, 2014, 9:11 a.m. |
OK |
GNU C++0x |
TESTS |
43 |
218 |
5324800 |
|
2200 |
6793476 |
704764513 |
D |
June 4, 2014, 4:13 a.m. |
OK |
GNU C++0x |
TESTS |
43 |
218 |
5427200 |
|
2200 |
6780893 |
qpalz |
D |
June 2, 2014, 9:33 a.m. |
OK |
GNU C++0x |
TESTS |
43 |
233 |
3993600 |
|
2200 |
8716081 |
I_love_Hoang_Yen |
D |
Nov. 17, 2014, 6:39 a.m. |
OK |
GNU C++0x |
TESTS |
43 |
280 |
1740800 |
|
2200 |
6946759 |
Farimart |
D |
June 23, 2014, 9:39 a.m. |
OK |
GNU C++0x |
TESTS |
43 |
296 |
2969600 |
|
2200 |
6756175 |
AndreiNet |
D |
May 31, 2014, 9:20 a.m. |
OK |
GNU C++0x |
TESTS |
43 |
327 |
1945600 |
|
2200 |
6748454 |
AndreiNet |
D |
May 30, 2014, 4:38 p.m. |
OK |
GNU C++0x |
TESTS |
43 |
327 |
1945600 |
|
2200 |
59873265 |
rainboy |
D |
Sept. 1, 2019, 8:46 p.m. |
OK |
GNU C11 |
TESTS |
43 |
624 |
3993600 |
|
2200 |
59873290 |
rainboy |
D |
Sept. 1, 2019, 8:46 p.m. |
OK |
GNU C11 |
TESTS |
43 |
639 |
3993600 |
|
2200 |
17822560 |
fengsuiyan |
D |
May 9, 2016, 3:56 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
124 |
7168000 |
|
2200 |
21411030 |
bluefi |
D |
Oct. 13, 2016, 7:13 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
171 |
6963200 |
|
2200 |
30948810 |
RNS_KSB |
D |
Oct. 2, 2017, 4:55 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
218 |
5529600 |
|
2200 |
16982710 |
ACErupt |
D |
March 28, 2016, 5:25 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
234 |
5734400 |
|
2200 |
10728507 |
delta_4d |
D |
April 15, 2015, 9:06 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
234 |
6144000 |
|
2200 |
11729790 |
yashkumar18 |
D |
June 24, 2015, 1:31 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
265 |
3584000 |
|
2200 |
16982729 |
ACErupt |
D |
March 28, 2016, 5:29 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
280 |
5734400 |
|
2200 |
17839710 |
snowy_smile |
D |
May 11, 2016, 6:53 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
312 |
6348800 |
|
2200 |
16775896 |
abcdeedcba |
D |
March 18, 2016, 5:36 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
327 |
2764800 |
|
2200 |
38826454 |
Bengal_Tiger |
D |
June 1, 2018, 11:37 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
405 |
6246400 |
|
2200 |
31630652 |
hahavodox |
D |
Oct. 23, 2017, 1:35 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
296 |
6656000 |
|
2200 |
49915476 |
alimagde |
D |
Feb. 14, 2019, 4:16 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
374 |
1740800 |
|
2200 |
48398894 |
anjn98 |
D |
Jan. 14, 2019, 7:23 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
390 |
1638400 |
|
2200 |
48532193 |
sarthak1220 |
D |
Jan. 18, 2019, 12:31 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
436 |
10444800 |
|
2200 |
36725262 |
aviroop123 |
D |
March 29, 2018, 3:37 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
451 |
5324800 |
|
2200 |
29232827 |
vjudge2 |
D |
Aug. 6, 2017, 4:36 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
452 |
4710400 |
|
2200 |
35970088 |
loyolman |
D |
March 5, 2018, 3:17 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
467 |
5222400 |
|
2200 |
23530818 |
Ali.Pi |
D |
Jan. 4, 2017, 8:11 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
467 |
6144000 |
|
2200 |
29234398 |
zstu_yjc |
D |
Aug. 6, 2017, 6:29 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
483 |
4710400 |
|
2200 |
29232822 |
RunningTime |
D |
Aug. 6, 2017, 4:36 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
499 |
4710400 |
|
2200 |
47499987 |
yaksha |
D |
Dec. 25, 2018, 5:16 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
312 |
1638400 |
|
2200 |
42091406 |
terminator |
D |
Aug. 25, 2018, 1:27 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
327 |
4710400 |
|
2200 |
39524425 |
customer101 |
D |
June 22, 2018, 5:58 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
483 |
2150400 |
|
2200 |
66992005 |
Phortox |
D |
Dec. 15, 2019, 9:05 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
483 |
13209600 |
|
2200 |
35732252 |
Transmigrationer |
D |
Feb. 26, 2018, 12:53 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
514 |
4608000 |
|
2200 |
52604853 |
DanWarren |
D |
April 11, 2019, 1:28 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
561 |
4300800 |
|
2200 |
45453979 |
karansiwach360 |
D |
Nov. 8, 2018, 5:47 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
561 |
14540800 |
|
2200 |
41238704 |
CrashMaster |
D |
Aug. 5, 2018, 8:50 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
592 |
3174400 |
|
2200 |
55078820 |
Photon_ |
D |
June 4, 2019, 9:51 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
592 |
17100800 |
|
2200 |
39007663 |
RedNextCentury |
D |
June 7, 2018, 3:12 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
608 |
32563200 |
|
2200 |
6891972 |
maxkvant |
D |
June 14, 2014, 7:46 p.m. |
OK |
Java 6 |
TESTS |
43 |
889 |
0 |
|
2200 |
6747877 |
uwi |
D |
May 30, 2014, 4:30 p.m. |
OK |
Java 7 |
TESTS |
43 |
343 |
0 |
|
2200 |
7575372 |
miguelmaurizio |
D |
Aug. 25, 2014, 8:25 p.m. |
OK |
Java 7 |
TESTS |
43 |
436 |
102400 |
|
2200 |
7247209 |
haminhngoc |
D |
July 26, 2014, 5:37 a.m. |
OK |
Java 7 |
TESTS |
43 |
529 |
0 |
|
2200 |
6751914 |
simenl |
D |
May 30, 2014, 6 p.m. |
OK |
Java 7 |
TESTS |
43 |
732 |
0 |
|
2200 |
6752148 |
dusty.and.rusty |
D |
May 30, 2014, 6:17 p.m. |
OK |
Java 7 |
TESTS |
43 |
779 |
1536000 |
|
2200 |
7217665 |
haminhngoc |
D |
July 24, 2014, 3:16 p.m. |
OK |
Java 7 |
TESTS |
43 |
811 |
0 |
|
2200 |
6752475 |
dusty.and.rusty |
D |
May 30, 2014, 6:54 p.m. |
OK |
Java 7 |
TESTS |
43 |
935 |
2048000 |
|
2200 |
6745199 |
qwerty787788 |
D |
May 30, 2014, 3:58 p.m. |
OK |
Java 7 |
TESTS |
43 |
982 |
204800 |
|
2200 |
6753231 |
wadissimo |
D |
May 30, 2014, 9:07 p.m. |
OK |
Java 7 |
TESTS |
43 |
997 |
307200 |
|
2200 |
6757435 |
alexey.kasatkin |
D |
May 31, 2014, 1:45 p.m. |
OK |
Java 7 |
TESTS |
43 |
1045 |
921600 |
|
2200 |
7575373 |
miguelmaurizio |
D |
Aug. 25, 2014, 8:26 p.m. |
OK |
Java 8 |
TESTS |
43 |
686 |
1536000 |
|
2200 |
9920372 |
niyaznigmatul |
D |
Feb. 18, 2015, 9:54 p.m. |
OK |
Java 8 |
TESTS |
43 |
842 |
0 |
|
2200 |
29100140 |
Imaginary |
D |
Aug. 1, 2017, 12:40 p.m. |
OK |
Java 8 |
TESTS |
43 |
1029 |
20582400 |
|
2200 |
44978733 |
xodiac |
D |
Oct. 28, 2018, 7:27 a.m. |
OK |
Java 8 |
TESTS |
43 |
1341 |
0 |
|
2200 |
59873264 |
Dukkha |
D |
Sept. 1, 2019, 8:46 p.m. |
OK |
Java 8 |
TESTS |
43 |
1513 |
0 |
|
2200 |
6750816 |
hiukim |
D |
May 30, 2014, 5:22 p.m. |
OK |
Java 8 |
TESTS |
43 |
1762 |
2355200 |
|
2200 |
39194794 |
amnesiac_dusk |
D |
June 12, 2018, 2:49 p.m. |
OK |
Java 8 |
TESTS |
43 |
1949 |
6246400 |
|
2200 |
19471706 |
alibaba |
D |
July 29, 2016, 3:59 a.m. |
OK |
Java 8 |
TESTS |
43 |
2371 |
0 |
|
2200 |
20454702 |
donli |
D |
Sept. 8, 2016, 9:06 a.m. |
OK |
Java 8 |
TESTS |
43 |
2417 |
0 |
|
2200 |
6747798 |
AlexFetisov |
D |
May 30, 2014, 4:29 p.m. |
OK |
Java 8 |
TESTS |
43 |
2823 |
1331200 |
|
2200 |
6756901 |
kasarino |
D |
May 31, 2014, 11:45 a.m. |
OK |
MS C# |
TESTS |
43 |
1060 |
2457600 |
|
2200 |
6828326 |
LightRay |
D |
June 6, 2014, 6:30 p.m. |
OK |
MS C++ |
TESTS |
43 |
187 |
5427200 |
|
2200 |
6832177 |
FxF |
D |
June 7, 2014, 10:40 a.m. |
OK |
MS C++ |
TESTS |
43 |
218 |
4300800 |
|
2200 |
6757972 |
bible |
D |
May 31, 2014, 4:05 p.m. |
OK |
MS C++ |
TESTS |
43 |
327 |
3276800 |
|
2200 |
6752042 |
Filyan |
D |
May 30, 2014, 6:09 p.m. |
OK |
MS C++ |
TESTS |
43 |
436 |
2764800 |
|
2200 |
7248728 |
pps789 |
D |
July 26, 2014, 9:37 a.m. |
OK |
MS C++ |
TESTS |
43 |
467 |
3379200 |
|
2200 |
6751541 |
scut__hanguoqiang |
D |
May 30, 2014, 5:44 p.m. |
OK |
MS C++ |
TESTS |
43 |
498 |
1740800 |
|
2200 |
6749512 |
GeKa |
D |
May 30, 2014, 4:56 p.m. |
OK |
MS C++ |
TESTS |
43 |
499 |
1638400 |
|
2200 |
6749962 |
SlavaSSU |
D |
May 30, 2014, 5:05 p.m. |
OK |
MS C++ |
TESTS |
43 |
514 |
3993600 |
|
2200 |
7149008 |
csehydrogen |
D |
July 18, 2014, 12:46 p.m. |
OK |
MS C++ |
TESTS |
43 |
561 |
3993600 |
|
2200 |
6751452 |
Svyat |
D |
May 30, 2014, 5:42 p.m. |
OK |
MS C++ |
TESTS |
43 |
577 |
8396800 |
|
2200 |
remove filters
Back to search problems