QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#636322#9462. Safest Buildingsucup-team191#TL 0ms0kbC++23912b2024-10-12 23:21:432024-10-12 23:21:43

Judging History

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

  • [2024-10-12 23:21:43]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-10-12 23:21:43]
  • 提交

answer

#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>

#define PB push_back

using namespace std;

typedef pair < int, int > pii;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int T; cin >> T;
	for(;T--;) {
		int n, r, R; scanf("%d%d%d", &n, &R, &r);
		vector < pii > v;
		for(int i = 1;i <= n;i++) {
			int x, y; scanf("%d%d", &x, &y);
			v.PB({x * x + y * y, i});
		}
		sort(v.begin(), v.end());
		int ans = 0;
		if(v[0].first <= (R - r) * (R - r)) {
			for(pii x : v) ans += x.first <= (R - r) * (R - r);
			printf("%d\n", ans);	
			for(pii x : v) if(x.first <= (R - r) * (R - r)) printf("%d ", x.second);
			printf("\n");

		} else {
			for(pii x : v) ans += x.first == v[0].first;		
			printf("%d\n", ans);	
			for(pii x : v) if(x.first == v[0].first) printf("%d ", x.second);
			printf("\n");
		}
	}
	return 0;
}

詳細信息

Test #1:

score: 0
Time Limit Exceeded

input:

2
3 10 5
3 4
3 5
3 6
3 10 4
-7 -6
4 5
5 4

output:


result: