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 're given a matrix A of size n xe2 x80 x89 xc3 x97 xe2 x80 x89n. Let 's call the matrix with nonnegative elements magic if it is symmetric (so aij xe2 x80 x89= xe2 x80 x89aji), aii xe2 x80 x89= xe2 x80 x890 and aij xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89max(aik, xe2 x80 x89ajk) for all triples i, xe2 x80 x89j, xe2 x80 x89k. Note that i, xe2 x80 x89j, xe2 x80 x89k do not need to be distinct. Determine if the matrix is magic. As the input/output can reach very huge size it is recommended to use fast input/output methods: for example, prefer to use scanf/printf instead of cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java. The first line contains integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x892500) -- the size of the matrix A. Each of the next n lines contains n integers aij (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89aij xe2 x80 x89< xe2 x80 x89109) -- the elements of the matrix A. Note that the given matrix not necessarily is symmetric and can be arbitrary. Print ' 'MAGIC" (without quotes) if the given matrix A is magic. Otherwise print ' 'NOT MAGIC". '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
16471760 |
sgtlaugh |
F |
March 2, 2016, 7:14 p.m. |
OK |
GNU C |
TESTS |
34 |
4508 |
25600000 |
|
2400 |
19187156 |
vjtest |
F |
July 17, 2016, 8:55 a.m. |
OK |
GNU C++ |
TESTS |
34 |
358 |
25292800 |
|
2400 |
19187195 |
vjtest |
F |
July 17, 2016, 8:57 a.m. |
OK |
GNU C++ |
TESTS |
34 |
374 |
25292800 |
|
2400 |
19146361 |
vjtest |
F |
July 15, 2016, 7:33 a.m. |
OK |
GNU C++ |
TESTS |
34 |
389 |
50380800 |
|
2400 |
19109240 |
PPFish |
F |
July 14, 2016, 1:56 p.m. |
OK |
GNU C++ |
TESTS |
34 |
389 |
50380800 |
|
2400 |
19192177 |
vjtest |
F |
July 17, 2016, 3:07 p.m. |
OK |
GNU C++ |
TESTS |
34 |
390 |
25292800 |
|
2400 |
40984995 |
ReaLNero1 |
F |
July 30, 2018, 7:41 p.m. |
OK |
GNU C++ |
TESTS |
34 |
390 |
25395200 |
|
2400 |
41242588 |
vjudge4 |
F |
Aug. 5, 2018, 11:17 a.m. |
OK |
GNU C++ |
TESTS |
34 |
405 |
25497600 |
|
2400 |
41140466 |
CalvinJin |
F |
Aug. 3, 2018, 2:25 a.m. |
OK |
GNU C++ |
TESTS |
34 |
405 |
25497600 |
|
2400 |
25177423 |
zhan8855 |
F |
March 3, 2017, 2:42 p.m. |
OK |
GNU C++ |
TESTS |
34 |
405 |
74240000 |
|
2400 |
28326341 |
xzyxzy |
F |
July 6, 2017, 12:12 p.m. |
OK |
GNU C++ |
TESTS |
34 |
420 |
52531200 |
|
2400 |
61026959 |
rainboy |
F |
Sept. 21, 2019, 4:17 p.m. |
OK |
GNU C11 |
TESTS |
34 |
1700 |
62668800 |
|
2400 |
50768581 |
luogu_bot5 |
F |
March 4, 2019, 1:41 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
233 |
26214400 |
|
2400 |
50769847 |
luogu_bot5 |
F |
March 4, 2019, 3:27 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
248 |
26214400 |
|
2400 |
50769904 |
QAQ_yyy_qwq |
F |
March 4, 2019, 3:31 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
248 |
26214400 |
|
2400 |
50767490 |
luogu_bot3 |
F |
March 4, 2019, 12:09 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
249 |
28160000 |
|
2400 |
51291103 |
X_o_r |
F |
March 14, 2019, 10:17 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
264 |
25088000 |
|
2400 |
50769941 |
QAQ_yyy_qwq |
F |
March 4, 2019, 3:34 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
264 |
26214400 |
|
2400 |
58468876 |
little_misfortune |
F |
Aug. 8, 2019, 9:40 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
264 |
51200000 |
|
2400 |
50773141 |
crpboy |
F |
March 4, 2019, 6:30 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
280 |
25190400 |
|
2400 |
51262681 |
luogu_bot1 |
F |
March 13, 2019, 2 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
280 |
25190400 |
|
2400 |
50771914 |
crpboy |
F |
March 4, 2019, 5:36 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
280 |
25190400 |
|
2400 |
51289643 |
XSamsara |
F |
March 14, 2019, 9:24 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
358 |
50483200 |
|
2400 |
51297494 |
ZigZagK |
F |
March 14, 2019, 12:59 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
358 |
50483200 |
|
2400 |
28984554 |
Sdywolf |
F |
July 30, 2017, 7:03 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
467 |
27545600 |
|
2400 |
51288034 |
yekehe |
F |
March 14, 2019, 8:28 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
795 |
62976000 |
|
2400 |
28685382 |
demerzel |
F |
July 19, 2017, 5:42 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
1590 |
195174400 |
|
2400 |
67615139 |
whyamievenhere |
F |
Dec. 25, 2019, 4:55 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
1778 |
26112000 |
|
2400 |
30553754 |
Perforator |
F |
Sept. 20, 2017, 5:25 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
1809 |
25497600 |
|
2400 |
35200685 |
kefaa2 |
F |
Feb. 13, 2018, 1:43 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
1809 |
115712000 |
|
2400 |
27329187 |
zlc1114 |
F |
May 25, 2017, 4:30 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
1856 |
25497600 |
|
2400 |
21739758 |
giwoo123 |
F |
Oct. 24, 2016, 11:36 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
1903 |
25395200 |
|
2400 |
61310012 |
FallingStar |
F |
Sept. 26, 2019, 8:53 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
1699 |
25292800 |
|
2400 |
66932219 |
rares2004 |
F |
Dec. 15, 2019, 7:41 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
1824 |
62668800 |
|
2400 |
47168161 |
Minnakhmetov |
F |
Dec. 17, 2018, 1:34 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
1902 |
100864000 |
|
2400 |
66516280 |
AlexLuchianov |
F |
Dec. 8, 2019, 7:04 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
1903 |
100761600 |
|
2400 |
62226980 |
Hoshi08 |
F |
Oct. 9, 2019, 7:18 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
1981 |
126054400 |
|
2400 |
47168175 |
Minnakhmetov |
F |
Dec. 17, 2018, 1:34 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
2043 |
100864000 |
|
2400 |
55206327 |
AliShahali1382 |
F |
June 6, 2019, 12:43 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
2089 |
75980800 |
|
2400 |
55204951 |
AliShahali1382 |
F |
June 6, 2019, 12:10 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
2105 |
75980800 |
|
2400 |
58088744 |
roll_no_1 |
F |
July 31, 2019, 4:42 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
2136 |
133017600 |
|
2400 |
67619742 |
Jester |
F |
Dec. 25, 2019, 6:14 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
2168 |
176537600 |
|
2400 |
61027037 |
Dukkha |
F |
Sept. 21, 2019, 4:19 p.m. |
OK |
Java 8 |
TESTS |
34 |
2027 |
142336000 |
|
2400 |
16444961 |
mmaxio |
F |
March 1, 2016, 3:27 p.m. |
OK |
Java 8 |
TESTS |
34 |
3337 |
177459200 |
|
2400 |
16720054 |
fmoraes |
F |
March 14, 2016, 6:46 p.m. |
OK |
Java 8 |
TESTS |
34 |
3524 |
239923200 |
|
2400 |
16651810 |
iblacksun |
F |
March 11, 2016, 3:39 p.m. |
OK |
MS C++ |
TESTS |
34 |
1279 |
31641600 |
|
2400 |
16469357 |
Taube |
F |
March 2, 2016, 4:57 p.m. |
OK |
MS C++ |
TESTS |
34 |
1341 |
25190400 |
|
2400 |
16622327 |
AleksanderBalobanov |
F |
March 9, 2016, 6:29 p.m. |
OK |
MS C++ |
TESTS |
34 |
1450 |
72806400 |
|
2400 |
16450068 |
sister_what_hate_most |
F |
March 1, 2016, 4:57 p.m. |
OK |
MS C++ |
TESTS |
34 |
2791 |
101785600 |
|
2400 |
44947539 |
kobae964 |
F |
Oct. 27, 2018, 10:32 a.m. |
OK |
Rust |
TESTS |
34 |
3650 |
256716800 |
|
2400 |
remove filters
Back to search problems