QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#630490 | #5141. Identical Parity | fafafakkk | WA | 0ms | 3656kb | C++14 | 890b | 2024-10-11 18:49:51 | 2024-10-11 18:49:52 |
Judging History
answer
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
const int N = 200005;
const int inf = 1e9;
void solve() {
int n, k; cin >> n >> k;
if (n % 2 == 0) {
if (k % 2 == 0) {
if ((n % k % 2) == 0) {
cout << "YES" << endl;
return;
}
} else {
if (k / 2 >= n - k && n % k >= n / k) {
if ((n % k - n / k) % 2 == 0) {
cout << "YES" << endl;
return;
}
}
}
} else {
if (k % 2 == 0) {
if ((n % k % 2) == 1) {
cout << "YES" << endl;
return;
}
} else {
if (k / 2 >= n / k - 1 && n % k >= n / k - 1) {
if (n % k - (n / k - 1) % 2 == 0) {
cout << "YES" << endl;
return;
}
}
}
}
cout << "NO" << endl;
return;
}
signed main() {
ios::sync_with_stdio(false),cin.tie(0);
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: 3656kb
input:
3 3 1 4 2 5 3
output:
NO YES NO
result:
wrong answer expected YES, found NO [3rd token]