Submission #143031

# Submission time Handle Problem Language Result Execution time Memory
143031 2019-08-12T16:16:29 Z Azert Košnja (COCI17_kosnja) C++14
50 / 50
23 ms 1272 KB
#include <bits/stdc++.h>
using namespace std;

int Q, m, n, res;

int main() {
    scanf("%d", &Q);
    while (Q--) {
        scanf("%d%d", &m, &n);
        int circle = min(m, n) / 2 + (min(m, n) % 2 != 0);
        if (circle >= 2) res = (circle - 2) * 4 + ((min(n, m) % 2 == 0)? 3 : 1) + 3;
        else {
            res = (min(m, n) == 2)? 3 : 0;
        }
        printf("%d\n", res);
    }
}

Compilation message

kosnja.cpp: In function 'int main()':
kosnja.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &Q);
     ~~~~~^~~~~~~~~~
kosnja.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &m, &n);
         ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 15 ms 888 KB Output is correct
7 Correct 21 ms 1272 KB Output is correct
8 Correct 15 ms 888 KB Output is correct
9 Correct 23 ms 1272 KB Output is correct
10 Correct 16 ms 1016 KB Output is correct