QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#45423#4393. Snatch GroceriesmiaomiaoziAC ✓42ms4364kbC++171.1kb2022-08-23 18:13:572022-08-23 18:14:00

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-08-23 18:14:00]
  • 评测
  • 测评结果:AC
  • 用时:42ms
  • 内存:4364kb
  • [2022-08-23 18:13:57]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
// https://space.bilibili.com/672346917

#ifndef LOCAL
#define LOG(...) 42
#endif

#define fi first
#define se second
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long LL;
typedef pair <int, int> PII;

constexpr int inf = 0x3f3f3f3f;
constexpr double EPS = 1e-8;
const double PI = acos(-1);

int multi_cases = 1;

void A_SOUL_AvA () {
    int n;
    cin >> n;

    vector <PII> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].fi >> a[i].se;
    }

    sort(all(a), [&](auto &u, auto &v) {
        return u < v;
    });

    int last = -1, ans = 0;
    for (int i = 0; i < n; i++) {
        if (i + 1 < n && a[i + 1].fi <= a[i].se) {
            break;
        }
        ans++;
    }

    cout << ans << endl;
}

int main () {
    cin.tie(nullptr)->sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int T = 1;
    for (multi_cases && cin >> T; T; T--) {
        A_SOUL_AvA ();
    }

    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 42ms
memory: 4364kb

input:

5
3
1 2
3 4
5 6
3
1 2
3 4
4 5
100000
263324740 263324748
920719069 920719077
82595123 82595132
765796214 765796222
621714954 621714959
77799324 77799332
278166427 278166428
375391536 375391545
856576804 856576812
512542774 512542781
829984452 829984457
302442403 302442404
779239984 779239986
1189173...

output:

3
1
275
5575
10000

result:

ok 5 lines