Submission #143031

#TimeUsernameProblemLanguageResultExecution timeMemory
143031AzertKošnja (COCI17_kosnja)C++14
50 / 50
23 ms1272 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...