QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#335425#7741. Counterucup-team1055#AC ✓87ms5148kbC++201.1kb2024-02-23 13:11:202024-02-23 13:11:20

Judging History

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

  • [2024-02-23 13:11:20]
  • 评测
  • 测评结果:AC
  • 用时:87ms
  • 内存:5148kb
  • [2024-02-23 13:11:20]
  • 提交

answer

#include <bits/stdc++.h>

#define rep(i,s,n) for(int i = int(s); i < int(n); i++)
#define rrep(i,s,n) for(int i = int(n) - 1; i >= int(s); i--)
#define all(v) (v).begin(), (v).end()

using ll = long long;
using ull = unsigned long long;
using ld = long double;

bool chmin(auto &a, auto b) {
    if(a <= b) return false;
    a = b;
    return true;
}

bool chmax(auto &a, auto b) {
    if(a >= b) return false;
    a = b;
    return true;
}

void solve() {
    ll n,m;
    std::cin >> n >> m;
    std::vector<std::pair<ll,ll>> ab(m);
    for(auto &[a, b]: ab) {
        std::cin >> a >> b;
    }
    ll now = 0, i = 0;
    std::sort(all(ab));
    for(auto [a, b]: ab) {
        ll d = a - i;
        if(now + d == b || b <= d - 1) {
            i = a;
            now = b;
        }
        else {
            std::cout << "No\n";
            return;
        }
    }
    std::cout << "Yes\n";
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int t;
    std::cin >> t;
    while(t--) {
        solve();
    }
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
7 4
4 0
2 2
7 1
5 1
3 2
2 2
3 1
3 1
3 100

output:

Yes
No
No

result:

ok 3 lines

Test #2:

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

input:

5610
1000000000 9
21408920 21408920
639702953 5628375
678176260 35373514
675909632 33106886
763056067 22659772
634660067 585489
674936674 762263554
637415497 3340919
638759931 4685353
1000000000 9
181850524 41335018
199253466 58737960
991953096 345115785
151207006 10691500
478549434 191746502
105653...

output:

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

result:

ok 5610 lines

Test #3:

score: 0
Accepted
time: 87ms
memory: 5148kb

input:

5
1000000000 100000
547678834 188839
397793147 14792
506016255 13227
221799665 127754
599008356 363144
229750198 51359
745400902 120196
199424849 134343
92319760 53188
854824512 110112
836744522 662
731417576 4991
727726496 91833
806187140 65275
106499884 83482
101812456 46836
253971728 117747
27026...

output:

Yes
No
No
Yes
No

result:

ok 5 lines

Test #4:

score: 0
Accepted
time: 81ms
memory: 4428kb

input:

10
1000000000 50000
325131690 27870
495358119 14916
483083615 20903
350409066 752
267334729 567
797038342 21566
985946898 25128
531325143 294
372615334 145
734411884 1455
42395178 3150
55651126 21677
836937065 37580
337422910 9351
716061322 15805
384110398 10055
609169805 574
910889923 49427
3940241...

output:

Yes
No
Yes
Yes
No
No
No
No
Yes
Yes

result:

ok 10 lines

Extra Test:

score: 0
Extra Test Passed