QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#196491 | #6893. Kong Ming Qi | Royo# | WA | 0ms | 3620kb | C++20 | 1.6kb | 2023-10-01 18:16:04 | 2023-10-01 18:16:04 |
Judging History
answer
#include <bits/stdc++.h>
#include <cstdio>
#define int long long
#define PII pair<int, int>
#pragma GCC optimize("Ofast")
#define NO {puts("No") ; return ;}
#define YES {puts("Yes") ; return ;}
#define pb push_back
#define endl "\n"
#define fi first
#define se second
#define IOS std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
using namespace std;
mt19937 rd(time(0));
const int N = 1e5 + 10;
int n, m;
void calc1(int x, int y) {
if (y > x) swap(x, y);
cout << (x + 1) / 2 << endl;
}
void solve() {
cin >> n >> m;
if (n == 1 && m == 1) {
cout << 1 << endl;
return ;
}
if (n == 1 || m == 1) {
calc1(n, m);
return ;
}
if (n >= 4) {
n %= 3;
}
if (m >= 4) {
m %= 3;
}
if (n == 1 && m == 1) {
cout << 2 << endl;
} else {
if (n == 1 && m == 2) {
cout << 1 << endl;
return ;
} else if (n == 1 && m == 3) {
cout << 2 << endl;
return ;
} else if (n == 2 && m == 2) {
cout << 1 << endl;
return ;
} else if (n == 2 && m == 3) {
cout << 2 << endl;
return ;
} else if (n == 3 && m == 3) {
cout << 2 << endl;
return ;
}
swap(n, m);
if (n == 1 && m == 2) {
cout << 1 << endl;
return ;
} else if (n == 1 && m == 3) {
cout << 2 << endl;
return ;
} else if (n == 2 && m == 2) {
cout << 1 << endl;
return ;
} else if (n == 2 && m == 3) {
cout << 2 << endl;
return ;
} else if (n == 3 && m == 3) {
cout << 2 << endl;
return ;
}
}
}
signed main() {
IOS;
int t; cin >> t;
while (t -- )
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
100 1 1 2 1 3 1 4 1 5 1 6 1 1 2 2 2 3 2 4 2 5 2 6 2 1 3 2 3 3 3 4 3 5 3 6 3 1 4 2 4 3 4 4 4 5 4 6 4 1 5 2 5 3 5 4 5 5 5 6 5 1 6 2 6 3 6 4 6 5 6 6 6 1 27 28 1 1 29 30 1 1 31 32 1 1 33 34 1 1 35 36 1 2 27 28 2 2 29 30 2 2 31 32 2 2 33 34 2 2 35 36 2 3 27 28 3 3 29 30 3 3 31 32 3 3 33 34 3 3 35 36 3 4 ...
output:
1 1 2 2 3 3 1 1 2 1 1 2 2 2 2 2 2 1 2 2 1 3 1 2 1 1 3 14 14 15 15 16 16 17 17 18 18 1 1 1 1 1 1 2 2 2 2 2 2 2 1 2 1 2 1 2 1 1 1 2 1 1 1
result:
wrong answer 18th lines differ - expected: '2', found: '1'