QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#521650 | #7042. So Easy | LuCiiiD# | AC ✓ | 42ms | 11448kb | C++23 | 1.4kb | 2024-08-16 13:36:41 | 2024-08-16 13:36:46 |
Judging History
answer
#include <bits/stdc++.h>
#define _11037_ ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl '\n'
#define int long long
#define inf 4e18
#define MAX 1005
using namespace std;
int maze[MAX][MAX];
inline void read(int &a)
{
int s = 0, w = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
s = s * 10 + ch - '0';
ch = getchar();
}
a = s * w;
}
int n, ans;
signed main()
{
_11037_
cin >> n;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
cin >> maze[i][j];
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
if (maze[i][j] == -1)
{
if (i - 1 >= 1 && j - 1 >= 1)
ans = maze[i - 1][j] + maze[i][j - 1] - maze[i - 1][j - 1];
else if (i + 1 <= n && j + 1 <= n)
ans = maze[i + 1][j] + maze[i][j + 1] - maze[i + 1][j + 1];
else if (i - 1 >= 1 && j + 1 <= n)
ans = maze[i - 1][j] + maze[i][j + 1] - maze[i - 1][j + 1];
else if (i + 1 <= n && j - 1 >= 1)
ans = maze[i + 1][j] + maze[i][j - 1] - maze[i + 1][j - 1];
}
cout << ans << endl;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
input:
3 1 2 1 0 -1 0 0 1 0
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
10 63 66 64 39 41 64 67 46 45 56 67 70 68 43 45 68 71 50 49 60 72 75 73 48 50 73 76 55 54 65 64 67 65 40 42 65 68 47 46 57 81 84 82 57 59 82 85 64 63 74 43 46 44 19 21 44 47 26 25 36 45 48 46 21 23 -1 49 28 27 38 70 73 71 46 48 71 74 53 52 63 57 60 58 33 35 58 61 40 39 50 81 84 82 57 59 82 85 64 63 74
output:
46
result:
ok 1 number(s): "46"
Test #3:
score: 0
Accepted
time: 0ms
memory: 4092kb
input:
100 36 58 36 31 46 52 39 42 28 35 54 32 31 37 37 36 30 32 27 41 44 39 45 42 57 40 35 43 40 36 40 29 71 38 40 45 46 31 31 44 52 44 66 38 56 40 35 28 37 27 28 33 37 35 27 41 34 55 34 67 57 45 44 35 27 29 47 37 51 43 46 30 32 50 48 59 50 35 37 40 43 44 38 27 48 34 31 45 35 36 44 37 55 35 37 34 40 54 31...
output:
32
result:
ok 1 number(s): "32"
Test #4:
score: 0
Accepted
time: 35ms
memory: 11448kb
input:
1000 72 98 15 95 62 91 0 49 0 0 0 0 31 34 0 62 0 59 155 0 57 0 24 0 0 118 84 74 0 118 92 0 151 172 55 97 0 0 0 39 0 0 27 149 0 0 73 0 93 77 0 0 0 0 0 0 0 18 0 0 62 0 154 147 184 0 34 99 122 78 0 96 48 0 0 95 85 0 94 0 262 0 138 0 42 0 192 186 0 0 71 61 60 80 0 59 90 0 0 93 79 92 51 146 42 161 0 80 8...
output:
14
result:
ok 1 number(s): "14"
Test #5:
score: 0
Accepted
time: 39ms
memory: 11100kb
input:
946 190332 496619 233226 513372 173426 473056 564990 436822 408812 196269 147901 258053 272675 380312 583582 339352 451363 538533 311062 404021 262637 458875 446837 383779 273156 227142 394125 405113 281125 335122 307196 347525 577796 333796 252513 423799 417315 203820 311700 300052 482305 140348 14...
output:
565344
result:
ok 1 number(s): "565344"
Test #6:
score: 0
Accepted
time: 41ms
memory: 10876kb
input:
924 250813 383230 167179 217308 214822 505276 202168 470854 308435 122003 277101 504050 298746 577234 502827 373238 272318 587439 330133 443002 237378 531448 322760 578450 230169 480966 149815 458363 292321 310182 314544 119703 524194 600506 474630 172241 385462 165132 152397 558997 590162 152448 17...
output:
596615
result:
ok 1 number(s): "596615"
Test #7:
score: 0
Accepted
time: 41ms
memory: 11228kb
input:
970 770001 578818 868816 825733 578120 900691 839349 950668 612547 952228 906303 613241 729306 665718 922074 757394 634570 540832 794986 981985 657902 604021 603173 760197 769773 543765 864214 874807 612493 743950 767676 700859 820863 676191 547017 825173 758097 585152 897584 859236 602507 890936 70...
output:
824274
result:
ok 1 number(s): "824274"
Test #8:
score: 0
Accepted
time: 41ms
memory: 10792kb
input:
915 652381 733110 583374 351568 441416 337397 339720 752379 334069 645642 398695 681137 577276 725832 800025 600254 414232 452931 677250 384158 537130 581081 342289 454868 631274 565270 441803 695737 486882 540910 596923 377524 589161 806094 536815 436808 630730 463876 505961 576886 656146 724935 68...
output:
459171
result:
ok 1 number(s): "459171"
Test #9:
score: 0
Accepted
time: 40ms
memory: 11156kb
input:
961 212861 524209 421814 459991 482812 274105 435605 232191 596886 517158 432383 372914 549128 273021 623757 538627 680970 406324 559513 423139 470577 558141 622701 636614 534069 223580 601981 612180 265758 474676 550052 554190 481341 381777 704714 685251 407851 425188 292439 281610 668490 504715 61...
output:
360088
result:
ok 1 number(s): "360088"
Test #10:
score: 0
Accepted
time: 42ms
memory: 11264kb
input:
974 567390 396965 573671 731557 441168 526496 307260 769003 330617 458895 671904 494270 289439 398373 461384 461200 510714 463249 328465 525031 714776 562893 296161 341634 717828 483663 581313 476404 766770 396074 574589 640551 559604 572852 290573 695049 458208 404840 352432 565107 651163 331134 73...
output:
533739
result:
ok 1 number(s): "533739"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
2 -1 2 3 4
output:
1
result:
ok 1 number(s): "1"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
2 1 -1 3 4
output:
2
result:
ok 1 number(s): "2"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
2 1 2 -1 4
output:
3
result:
ok 1 number(s): "3"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
2 1 2 3 -1
output:
4
result:
ok 1 number(s): "4"