#include <stdio.h>
int a, b;
int main(){
scanf("%d%d", &a, &b);
int minabs = 2147483647;
int zero = 0, minus = 0;
int i, j;
int sum = 0;
for(i = 0; i < a; i++){
for(j = 0; j < b; j++){
int x;
scanf("%d", &x);
int absx = x < 0 ? -x : x;
if(absx < minabs) minabs = absx;
sum += absx;
if(x == 0) zero++;
if(x < 0) minus++;
}
}
if(a % 2 == 0 && b % 2 == 0 && minus % 2 == 1 && zero == 0) sum -= 2 * minabs;
printf("%d 0\n", sum);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
2 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
3 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
4 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
5 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
6 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
7 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
8 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
9 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
10 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
11 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
12 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
13 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
14 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
15 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
16 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
17 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
18 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
19 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
20 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
21 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
22 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
23 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
24 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
25 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
26 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
27 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
28 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
29 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |
30 |
Partially correct |
0 ms |
1088 KB |
Output is partially correct |