#include<stdio.h>
int R, C;
int map[101][101];
int main()
{
int sum = 0;
int count_zero = 0;
int count_neg = 0;
int max_neg = -1999999999;
int min_pos = 1999999999;
scanf("%d %d", &R, &C);
for(int i = 1; i <= R; i++) for(int j = 1; j <= C; j++){
scanf("%d", &map[i][j]);
if(map[i][j] > 0) sum += map[i][j];
else sum -= map[i][j];
if(map[i][j] == 0) count_zero ++;
if(map[i][j] < 0){
count_neg ++;
if(max_neg < map[i][j]) max_neg = map[i][j];
}
if(map[i][j] > 0){
if(min_pos > map[i][j]) min_pos = map[i][j];
}
}
if(count_zero != 0 || count_neg % 2 == 0 || R == 1 || C == 1 || R%2 == 1 || C%2 == 1)
printf("%d 2\nrotC 1 1\nnegR 1\n", sum);
else {
if((max_neg * -1) > min_pos){
sum -= min_pos * 2;
} else {
sum += max_neg * 2;
}
printf("%d 2\nrotC 1 1\nnegR 1\n", sum);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
2 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
3 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
4 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
5 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
6 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
7 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
8 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
9 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
10 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
11 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
12 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
13 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
14 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
15 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
16 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
17 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
18 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
19 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
20 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
21 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
22 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
23 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
24 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
25 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
26 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
27 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
28 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
29 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |
30 |
Partially correct |
0 ms |
1128 KB |
Output is partially correct |