QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#264946#7741. Counterucup-team1191#AC ✓87ms5172kbC++203.2kb2023-11-25 16:08:442023-11-25 16:08:44

Judging History

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

  • [2023-11-25 16:08:44]
  • 评测
  • 测评结果:AC
  • 用时:87ms
  • 内存:5172kb
  • [2023-11-25 16:08:44]
  • 提交

answer

/*
    author:  Maksim1744
    created: 25.11.2023 11:05:18
*/

#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

#define mp   make_pair
#define pb   push_back
#define eb   emplace_back

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

template<typename T>             vector<T>& operator--            (vector<T> &v){for (auto& i : v) --i;            return  v;}
template<typename T>             vector<T>& operator++            (vector<T> &v){for (auto& i : v) ++i;            return  v;}
template<typename T>             istream& operator>>(istream& is,  vector<T> &v){for (auto& i : v) is >> i;        return is;}
template<typename T>             ostream& operator<<(ostream& os,  vector<T>  v){for (auto& i : v) os << i << ' '; return os;}
template<typename T, typename U> pair<T,U>& operator--           (pair<T, U> &p){--p.first; --p.second;            return  p;}
template<typename T, typename U> pair<T,U>& operator++           (pair<T, U> &p){++p.first; ++p.second;            return  p;}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U> &p){is >> p.first >> p.second;        return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>  p){os << p.first << ' ' << p.second; return os;}
template<typename T, typename U> pair<T,U> operator-(pair<T,U> a, pair<T,U> b){return mp(a.first-b.first, a.second-b.second);}
template<typename T, typename U> pair<T,U> operator+(pair<T,U> a, pair<T,U> b){return mp(a.first+b.first, a.second+b.second);}
template<typename T, typename U> void umin(T& a, U b){if (a > b) a = b;}
template<typename T, typename U> void umax(T& a, U b){if (a < b) a = b;}

#ifdef HOME
#define SHOW_COLORS
#include "/mnt/c/Libs/tools/print.cpp"
#else
#define show(...) void(0)
#define debugf(fun)   fun
#define debugv(var)   var
#define mclock    void(0)
#define shows     void(0)
#define debug  if (false)
#define OSTREAM(...)    ;
#define OSTREAM0(...)   ;
#endif

void test_case(int test) {
    int n, m;
    cin >> m >> n;
    vector<pair<int, int>> v;
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        v.eb(a, b);
    }
    sort(v.begin(), v.end());
    if (v[0].second > v[0].first) {
        cout << "No\n";
        return;
    }
    for (int i = 1; i < v.size(); ++i) {
        if (v[i].second - v[i - 1].second == v[i].first - v[i - 1].first) continue;
        if (v[i].second > v[i].first - v[i - 1].first - 1) {
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    int T;
    cin >> T;
    for (int test = 1; test <= T; ++test) {
        test_case(test);
    }

    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 39ms
memory: 3760kb

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: 5172kb

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: 84ms
memory: 3948kb

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