# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
143031 | 2019-08-12T16:16:29 Z | Azert | Košnja (COCI17_kosnja) | C++14 | 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
# | 결과 | 실행 시간 | 메모리 | 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 |