UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#212753#3828. Bwangliwen12345601ms1240kbC++654b2024-10-20 10:31:442024-10-20 14:37:06

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a[2005][2005],x,y;
signed main() {
	scanf("%lld",&n);
	for(int i = 1;i <= n;i++) {
		for(int j = 1;j <= n;j++) {
			scanf("%lld",&a[i][j]);
			if(a[i][j] == -1) x = i,y = j;
		}
	}
	if(x < n and y < n) {
		printf("%lld\n",a[x + 1][y] + a[x][y + 1] - a[x + 1][y + 1]);
	}
	else if(x == 1 and y == n) {
		printf("%lld\n",a[x + 1][y] + a[x][y - 1] - a[x + 1][y - 1]);
	}
	else if(x == n and y == 1) {
		printf("%lld\n",a[x - 1][y] + a[x][y + 1] - a[x - 1][y + 1]);
	}
	else {
		printf("%lld\n",a[x - 1][y] + a[x][y - 1] - a[x - 1][y - 1]);
	}
	return 0;
}


Details

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1240kb

input:

10
3 3
0 1 2
3 4 5
6 7 8
3 3
0 1 2
3 4 5
6 8 7
3 3
0 1 2
3 4 5
7 6 8
3 3
0 1 2
3 4 5
7 8 6
3 3
0 1 2...

output:

-3

result:

wrong answer 1st numbers differ - expected: '5', found: '-3'

Subtask #2:

score: 0
Wrong Answer

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 1236kb

input:

10
22 45
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33...

output:

-22

result:

wrong answer 1st numbers differ - expected: '990', found: '-22'

Subtask #3:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 1ms
memory: 1232kb

input:

10
2 100000
143604 106821 145034 44402 118718 156663 77133 28800 81890 12336 191537 118894 103331 75...

output:

-2

result:

wrong answer 1st numbers differ - expected: '13', found: '-2'

Subtask #4:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 1240kb

input:

10
1 200000
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32...

output:

-1

result:

wrong answer 1st numbers differ - expected: '200000', found: '-1'

Subtask #5:

score: 0
Wrong Answer

Test #7:

score: 0
Wrong Answer
time: 0ms
memory: 1236kb

input:

10
145 1379
140324 86968 96426 123781 39754 103720 60835 118904 114639 53717 27146 110309 39232 5608...

output:

-145

result:

wrong answer 1st numbers differ - expected: '14', found: '-145'