QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#630490#5141. Identical ParityfafafakkkWA 0ms3656kbC++14890b2024-10-11 18:49:512024-10-11 18:49:52

Judging History

你现在查看的是最新测评结果

  • [2024-10-11 18:49:52]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3656kb
  • [2024-10-11 18:49:51]
  • 提交

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]