Submission #9412

#TimeUsernameProblemLanguageResultExecution timeMemory
9412coreaSolve another chuck (kriii2_S)C++14
1 / 4
0 ms1088 KiB
#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 timeMemoryGrader output
Fetching results...