QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#678756#5141. Identical Parityblue_skyTL 414ms4484kbC++201.1kb2024-10-26 16:03:042024-10-26 16:03:05

Judging History

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

  • [2024-10-26 16:03:05]
  • 评测
  • 测评结果:TL
  • 用时:414ms
  • 内存:4484kb
  • [2024-10-26 16:03:04]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define bug(X) cout << "bug:# " << X << endl
#define bug2(f, X) cout << "bug:# " << f << " " << X << endl
#define bug3(i, j, G) cout << "bug:# " << i << ' ' << j << ' ' << G << endl
#define endl '\n'
using namespace std;
const int mod = 998244353;
const int N = 10 + 5e5;
void _();
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    cin >> t;
    while (t--)
        _();
    return 0;
}

void _()
{
    int n, k;
    cin >> n >> k;
    int f = 1;
    int cnt_0, cnt_1;
    if (k & 1)
    {
        int _0 = k >> 1, _1 = k - _0;
        vector<int> a(k + 1, 1);
        for (int i = 1; i <= _0; i++)
            a[i] = 0;
        cnt_0 = n / k * _0, cnt_1 = n / k * _1;
        int left = n % k;
        for (int i = 1; i <= left; i++)
            if (a[i])
                cnt_1++;
            else
                cnt_0++;
        if (cnt_1 - cnt_0 > 1)
            f = 0;
    }

    cout << (f ? "Yes" : "No") << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3572kb

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: 0
Accepted
time: 15ms
memory: 3596kb

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:

Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes...

result:

ok 100000 token(s): yes count is 92971, no count is 7029

Test #3:

score: 0
Accepted
time: 11ms
memory: 3664kb

input:

100000
1 1
9 4
6 4
7 4
6 3
4 2
9 9
4 3
1 1
7 4
1 1
7 7
5 2
6 3
4 4
10 10
9 3
6 6
10 1
9 6
6 6
7 7
6 3
7 7
6 6
3 2
8 8
10 10
7 3
3 1
2 1
7 2
10 10
9 7
1 1
5 1
4 4
8 8
9 9
5 3
4 4
1 1
9 7
7 1
10 2
6 2
8 2
2 1
9 9
8 7
8 3
3 1
5 4
3 3
10 10
8 8
2 1
8 8
10 10
10 3
10 2
2 2
7 7
4 1
10 1
4 2
8 3
8 2
7 7
5 ...

output:

Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes...

result:

ok 100000 token(s): yes count is 70906, no count is 29094

Test #4:

score: 0
Accepted
time: 12ms
memory: 3680kb

input:

100000
24 8
34 34
89 44
53 30
33 33
77 77
16 16
85 85
14 5
75 75
14 9
78 67
53 53
73 10
73 11
44 4
97 31
88 22
99 78
63 54
100 3
11 9
67 12
55 22
63 14
20 10
82 62
75 10
92 1
39 34
77 15
7 7
76 6
45 9
96 48
30 7
4 4
12 11
9 6
76 16
96 18
58 6
8 8
51 10
100 8
69 69
78 74
35 6
77 70
63 63
35 22
20 3
3...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes...

result:

ok 100000 token(s): yes count is 78553, no count is 21447

Test #5:

score: 0
Accepted
time: 17ms
memory: 3744kb

input:

100000
192 41
865 10
277 236
404 298
745 211
762 762
736 711
340 38
489 25
870 105
688 40
160 159
658 649
783 783
477 250
257 18
568 23
395 138
719 359
778 554
124 124
498 5
483 257
267 16
75 21
683 341
127 64
526 10
296 15
487 295
239 15
111 7
253 21
770 14
265 24
389 235
786 504
564 564
411 276
38...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
N...

result:

ok 100000 token(s): yes count is 81455, no count is 18545

Test #6:

score: 0
Accepted
time: 48ms
memory: 3696kb

input:

100000
4003 575
7289 7046
8995 58
1577 733
9173 7729
844 52
8951 1352
7973 3986
5119 3924
4668 4668
7815 5841
739 451
4778 36
2188 2188
3484 1892
9258 66
533 377
9557 69
7404 265
9609 40
1214 1025
5665 812
8127 7347
5342 2671
1625 18
5216 3852
4270 46
5744 4027
8907 7170
3534 3420
7233 3113
8075 807...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes...

result:

ok 100000 token(s): yes count is 83348, no count is 16652

Test #7:

score: 0
Accepted
time: 414ms
memory: 4484kb

input:

100000
94582 94582
69291 14631
46488 10296
59177 160
78974 53928
94307 34407
52245 27037
12683 5798
57630 170
99882 304
48988 48988
42297 18726
67566 262
65662 57867
76780 67428
79156 73214
65758 12352
60103 60103
28738 17248
37409 37409
53728 17909
59800 39782
74537 74537
3041 138
30203 15734
11982...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Y...

result:

ok 100000 token(s): yes count is 84294, no count is 15706

Test #8:

score: -100
Time Limit Exceeded

input:

100000
50534 647
678283 980
30125 21366
248223 221768
985737 234150
387629 132381
904312 904312
467229 333595
738198 292290
570819 68
587262 766
802340 284
255271 182985
380342 126780
289440 80342
848027 848027
365288 517
41897 41897
248003 296
886340 443170
175494 35804
738204 534958
8090 6685
3621...

output:

No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Y...

result: