QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#647521 | #5141. Identical Parity | comp_towels_cat | WA | 9ms | 3716kb | C++17 | 3.4kb | 2024-10-17 14:33:29 | 2024-10-17 14:33:33 |
Judging History
answer
//#pragma GCC optimize(2)
//#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
#define FOR(i, j, k) for(int i = (j);i <= (k);i ++)
#define ROF(i, j, k) for(int i = (j);i >= (k);i --)
#define For(i, j, k) for(int i = (j);i < (k);i ++)
#define Rof(i, j, k) for(int i = (j);i > (k);i --)
#define ull unsigned long long
#define int long long
#define PII pair<int,int>
#define ULL unsigned long long
#define db double
#define x first
#define y second
#define sp(x) fixed << setprecision(x)
#define all(x) x.begin(), x.end()
#define unq_all(x) x.erase(unique(all(x)), x.end())
#define M(x) x %= mod, x += mod, x %= mod
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define Yes cout << "Yes\n"
#define No cout << "No\n"
#define ANS cout << ans << '\n'
#define de(p) cout << #p << ' ' << p << '\n'
#define END(i, n) (i == n ? '\n' : ' ')
#define double long double
#define RED cout << "\033[91m"
#define GREEN cout << "\033[92m"
#define YELLOW cout << "\033[93m"
#define BLUE cout << "\033[94m"
#define MAGENTA cout << "\033[95m"
#define CYAN cout << "\033[96m"
#define RESET cout << "\033[0m"
// 红色
#define DEBUG1(x) \
RED; \
cout << #x << " : " << x << endl; \
RESET;
// 绿色
#define DEBUG2(x) \
GREEN; \
cout << #x << " : " << x << endl; \
RESET;
// 蓝色
#define DEBUG3(x) \
BLUE; \
cout << #x << " : " << x << endl; \
RESET;
// 品红
#define DEBUG4(x) \
MAGENTA; \
cout << #x << " : " << x << endl; \
RESET;
// 青色
#define DEBUG5(x) \
CYAN; \
cout << #x << " : " << x << endl; \
RESET;
// 黄色
#define DEBUG6(x) \
YELLOW; \
cout << #x << " : " << x << endl; \
RESET;
using namespace std;
const int N = 5e5 + 10, M = 1e5 + 10, INF = 1e9, mod = 998244353;
int n, m, k;
void solve()
{
cin >> n >> k;
// int odd = (n + 1) / 2;
// int even = n / 2;
if (n % k == 0)
{
int t = n / k;
if (t % 2 == 1 || n % 2 == 1) NO;
else YES;
}
else
{
int cnt1 = k - n % k,v1 = n / k;
int cnt2 = n % k,v2 = n / k + 1;
int need = n / 2;
int x = need / (n / k),y = need % (n / k);
// v2 >= n / k;
// n / k 个 v2 拼 (n / k + 1) 个 t
if (y <= cnt2)
{
int now1 = 0,now2 = y;
x -= y;
if (x < 0)
{
NO;
}
else
{
int t1 = x / (n / k);
int t2 = (cnt2 - y) / (n / k);
t1 = min(t1,t2);
x -= t1 * (n / k);
if (x <= cnt1) YES;
else NO;
}
}
else
{
NO;
}
}
}
signed main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
auto t = clock();
int T = 1;
cin >> T;
while (T--)
{
solve();
}
auto tt = clock();
// cout << "Time: " << 1000.0 * (tt - t) / CLOCKS_PER_SEC << "ms" << endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
input:
3 3 1 4 2 5 3
output:
NO YES YES
result:
ok 3 token(s): yes count is 2, no count is 1
Test #2:
score: -100
Wrong Answer
time: 9ms
memory: 3716kb
input:
100000 1 1 2 1 2 2 3 1 3 2 3 3 4 1 4 2 4 3 4 4 5 1 5 2 5 3 5 4 5 5 6 1 6 2 6 3 6 4 6 5 6 6 7 1 7 2 7 3 7 4 7 5 7 6 7 7 8 1 8 2 8 3 8 4 8 5 8 6 8 7 8 8 9 1 9 2 9 3 9 4 9 5 9 6 9 7 9 8 9 9 10 1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 11 1 11 2 11 3 11 4 11 5 11 6 11 7 11 8 11 9 11 10 11 11 12 1 ...
output:
NO YES NO NO YES NO YES YES YES NO NO YES YES YES NO YES NO YES YES YES NO NO YES YES YES YES YES NO YES YES YES YES YES YES YES NO NO YES NO YES YES YES YES YES NO YES NO NO YES YES YES YES YES YES NO NO YES NO YES YES YES YES YES YES YES NO YES YES YES NO YES YES YES YES YES YES YES NO NO YES NO Y...
result:
wrong answer expected YES, found NO [1st token]