QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#634146#9462. Safest Buildingsucup-team5075#AC ✓0ms5960kbC++143.6kb2024-10-12 16:46:012024-10-12 16:46:02

Judging History

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

  • [2024-10-12 16:46:02]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:5960kb
  • [2024-10-12 16:46:01]
  • 提交

answer

#include <cstdio>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <cctype>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cmath>

namespace uvu
{
#define LOCAL ________________DONT_DEFINE_ME_______________
#define ll long long
#define inf 0x3f3f3f3f
// #define int long long
// #define inf 0x3f3f3f3f3f3f3f3fll
#define infll 0x3f3f3f3f3f3f3f3fll
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define gline debug("now is #%d\n", __LINE__)
#define pii std::pair <int, int>
#define mkp std::make_pair
#define fi first
#define se second
char _ST_;
const int BUFSIZE = (1 << 20);
char ibuf[BUFSIZE], *iS = ibuf, *iT = ibuf;
char obuf[BUFSIZE], *oS = obuf, *oT = obuf + BUFSIZE;
char getc()
{
#ifdef LOCAL
	return getchar();
#else
	if(iS == iT) iT = (iS = ibuf) + fread(ibuf, 1, BUFSIZE, stdin);
	return (iS == iT) ? EOF : *iS++;
#endif
#define getchar ERR
}
void Flush() { fwrite(obuf, 1, oS - obuf, stdout); oS = obuf; }
struct Flusher { ~Flusher() { Flush(); } }iamflusher;
void putc(char c)
{
#ifdef LOCAL
	putchar(c);
#else
	*oS++ = c;
	if(oS == oT) Flush();
#endif
}
template <typename T = int> T read()
{
	T x = 0, f = 1; char c = getc();
	for(; !isdigit(c); c = getc()) if(c == '-') f = -1;
	for(;  isdigit(c); c = getc()) x = (x << 3) + (x << 1) + (c ^ 48);
	return x * f;
}
template <typename T> void print(T x, char c)
{
static int sta[BUFSIZE], top;
	top = 0;
	if(x < 0) putc('-'), x *= -1;
	if(!x) sta[++top] = 0;
	for(; x; x /= 10) sta[++top] = x % 10;
	for(; top; putc(sta[top--] ^ 48));
	if(c) putc(c);
}
int readstr(char *s, int base)
{
	int idx = base - 1; char c = getc();
	for(; !(isdigit(c) || isalpha(c) || c == '#' || c == '.'); c = getc());
	for(;   isdigit(c) || isalpha(c) || c == '#' || c == '.' ; c = getc()) s[++idx] = c;
	return idx - base + 1;
}
void printf(const char *s) { for(; *s; s++) putc(*s); }
template <typename T, typename ... Args >
void printf(const char *s, T x, Args ... rest)
{
	for(; *s; s++)
	{
		if(*s != '%') { putc(*s); continue; }
		s++; if(*s == 'd') print(x, 0);
		else if(*s == 'c') putc(x);
		printf(s + 1, rest ...);
		return;
	}
}
template <typename T> void ckmin(T &x, T y) { x = x < y ? x : y; }
template <typename T> void ckmax(T &x, T y) { x = x > y ? x : y; }
#define mod 998244353
// #define mod 1000000007
int sm(int x) { return x >= mod ? x - mod : x; }
void plus_(int &x, int y) { x = sm(x + y); }
void mul_(int &x, int y) { x = 1ll * x * y % mod; }
int ksm(int a, int b) { int res = 1; for(; b; b >>= 1, mul_(a, a)) if(b & 1) mul_(res, a); return res; }

#define N 100010
int n, R, r;
int x_[N], y_[N];
int sta[N], top;

void solve()
{
	// memset(h, idx = -1, sizeof(h)); 
	n = read(), R = read(), r = read();
	for(int i = 1; i <= n; i++) x_[i] = read(), y_[i] = read();
	bool flg = 0;
	top = 0;
		for(int i = 1; i <= n; i++) if(x_[i] * x_[i] + y_[i] * y_[i] <= (R - r - r) * (R - r - r)) flg = 1;
		if(flg)
		{
			for(int i = 1; i <= n; i++) if(x_[i] * x_[i] + y_[i] * y_[i] <= (R - r - r) * (R - r - r)) sta[++top] = i;
		}
	if(!flg)
	{
		int mn = inf;
		for(int i = 1; i <= n; i++) ckmin(mn, x_[i] * x_[i] + y_[i] * y_[i]);
		for(int i = 1; i <= n; i++) if(mn == x_[i] * x_[i] + y_[i] * y_[i]) sta[++top] = i;
	}
	print(top, '\n');
	for(int i = 1; i <= top; i++) print(sta[i], ' ');
	putc('\n');
}
 
void init()
{

}
char _ED_;
void mian()
{
	debug("%.3f MB\n", abs(&_ST_ - &_ED_) / 1024.0 / 1024);
	init();
	int T = read();
	for(; T; solve(), T--);
}
#ifdef int
	#undef int
#endif
}

int main()
{
	uvu::mian(); return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 5888kb

input:

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

output:

1
1 
2
2 3 

result:

ok 5 tokens

Test #2:

score: 0
Accepted
time: 0ms
memory: 5960kb

input:

100
6 100 50
42 -31
-66 7
13 84
94 13
51 -14
-18 9
12 100 50
-78 56
-56 -64
-22 54
-41 14
-14 55
21 -83
75 21
-51 56
-31 74
-34 79
22 -37
1 -12
14 100 50
15 71
-44 41
-56 78
-48 22
42 -2
-70 28
51 -34
49 -31
-36 67
63 70
34 9
27 -33
36 -93
-52 -19
8 100 14
21 89
67 60
-12 -3
24 -37
-51 14
-30 8
-75 ...

output:

1
6 
1
12 
1
11 
4
3 4 5 6 
7
1 4 6 8 9 12 13 
1
1 
6
2 4 5 7 13 14 
7
1 3 4 5 6 7 9 
1
11 
9
1 2 3 4 5 6 7 8 9 
1
29 
1
5 
1
29 
47
1 2 3 4 5 6 7 9 10 11 12 14 17 18 19 21 22 24 25 26 27 28 30 31 32 33 34 35 36 37 38 39 40 41 43 44 45 46 47 48 50 51 52 53 54 55 56 
2
21 29 
20
1 5 6 7 10 13 14 18 2...

result:

ok 1674 tokens

Extra Test:

score: 0
Extra Test Passed