QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#45423 | #4393. Snatch Groceries | miaomiaozi | AC ✓ | 42ms | 4364kb | C++17 | 1.1kb | 2022-08-23 18:13:57 | 2022-08-23 18:14:00 |
Judging History
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