用户输出
2
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#68813 | #1110. JM的算命之术 | Accepted | 100 | 171 ms | 1924 K | C++ 11 / 1017 B | 该起什么名字 | 2022-04-11 17:56:48 |
#include <bits/stdc++.h>
#define F(i, n, m) for (int i = n; i < m; i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
inline int read() {
int num = 0;
char c;
bool flag = false;
while ((c = getchar()) == ' ' || c == '\n' || c == '\r')
;
if (c == '-')
flag = true;
else
num = c - '0';
while (isdigit(c = getchar())) num = num * 10 + c - '0';
return (flag ? -1 : 1) * num;
}
inline void write(int num) {
if (num < 0)
num = -num, putchar('-');
if (num / 10 > 0)
write(num / 10);
putchar(num % 10 + 48);
return;
}
struct LR {
int l, r;
} lr[200005];
bool cmp(LR a, LR b) {
if (a.l == b.l)
return a.r < b.r;
else
return a.l > b.l;
// return a.r<b.r;
}
int main() {
std::ios::sync_with_stdio(false);
int n;
n = read();
F(i, 0, n) {
lr[i].l = read();
lr[i].r = read();
}
sort(lr, lr + n, cmp);
int ans = 1;
int lx = lr[0].l;
// F(i,0,n) cout<<lr[i].l<<" "<<lr[i].r<<endl;
F(i, 0, n) {
if (lr[i].r < lx) {
lx = lr[i].l;
ans++;
}
}
write(ans);
return 0;
}
35
66 80
32 38
34 35
67 68
53 94
22 74
4 51
49 73
48 91
32 65
7 98
34 44
17 84
59 97
<146 bytes omitted>
用户输出
6
系统信息
Exited with return code 0
78
24 68
23 82
79 100
49 95
55 84
17 21
2 63
23 68
6 42
57 63
18 53
9 58
65 93
70 100
<450 bytes omitted>
用户输出
10
系统信息
Exited with return code 0
854
5467 8458
7427 9416
1559 9082
3181 3196
5447 6826
1999 2772
2244 3428
4117 7212
3813 64
<9182 bytes omitted>
用户输出
49
系统信息
Exited with return code 0
240
1953 7979
5806 6542
7242 9133
8990 9000
4834 5545
8182 9685
5894 9586
3365 8189
5 6
11
<2511 bytes omitted>
用户输出
25
系统信息
Exited with return code 0
30032
218959965 690036290
166253959 736069436
361427788 677032424
118917380 279117898
623364376
<627172 bytes omitted>
用户输出
264
系统信息
Exited with return code 0
45898
765768824 839988892
891645120 934820639
897049089 915703888
819012894 912957740
30009705
<958340 bytes omitted>
用户输出
351
系统信息
Exited with return code 0
25774
6004221 6004422
2395416 2395775
222086 222631
6374948 6375202
1191857 1192036
6457035 64
<432371 bytes omitted>
用户输出
12396
系统信息
Exited with return code 0
50591
8627751 8628150
6758169 6758440
1079056 1079416
4278009 4278052
1047972 1047975
66222 66
<848740 bytes omitted>
用户输出
17853
系统信息
Exited with return code 0
100000
400381387 805067386
967986006 976613391
358312144 799345458
407097998 966818388
72874808
<2088199 bytes omitted>
用户输出
511
系统信息
Exited with return code 0
200000
81284010 81284629
9776763 9777717
63372394 63372950
66341771 66341828
61340861 61341254
<3755341 bytes omitted>
用户输出
107784
系统信息
Exited with return code 0