Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
150959 | lrf820215 | 监测点 | C++ | 解答错误 | 0 | 0 MS | 252 KB | 728 | 2024-06-10 10:10:28 |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int l[n],r[n]; for(int i = 0;i<n;i++) cin>>l[i]>>r[i]; for(int i = 0;i<n-1;i++){//右边界排序 int temp; for(int j = i+1;j<n;j++){ if(r[i]>r[j]){ temp = r[i]; r[i] = r[j]; r[j] = temp; temp = l[i]; l[i] = l[j]; l[j] = temp; } } } int count = 1; int p = r[0]; for(int i = 1;i<n;i++){ int flag = 0; if(p<l[i]){ count++; p = r[i]; } } cout<<count; return 0; }