为什么暴力这样写只有 40 分?
查看原帖
为什么暴力这样写只有 40 分?
510555
ImposterAnYu楼主2021/12/17 22:41
#include<bits/stdc++.h>
#define int1 long long
using namespace std;
int1 n,m,a[1005],b[1005],i,j,s;
bool c[1005];
int main(){
	cin >> n >> m;
	for(i = 1; i <= m; i++){
		cin >> a[i] >> b[i];
	}
	for(i = 1; i <= m; i++){
		for(j = i + 1; j <= m; j++){
			if(a[i] >= a[j] && b[i] <= b[j] && i != j){
				c[i] = 1;
			}
		}
	}
	for(i = 1; i <= m; i++){
		s += (!c[i]);
		/*if(!c[i]){
			cout<< i << endl;
		}*/
	}
	cout<< s << endl;
	return 0;
}
2021/12/17 22:41
加载中...