QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#115303 | #2350. Integer Cow | ckiseki# | WA | 1ms | 3580kb | C++20 | 1.7kb | 2023-06-25 16:23:47 | 2023-06-25 16:23:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
template <typename ...T>
void debug_(const char *s, T ...a) {
cerr << "\e[1;32m(" << s << ") = (";
int cnt = sizeof...(T);
(..., (cerr << a << (--cnt ? ", " : ")\e[0m\n")));
}
template <typename I>
void orange_(const char *s, I L, I R) {
cerr << "\e[1;32m[ " << s << " ] = [ ";
for (int f = 0; L != R; ++L)
cerr << (f++ ? ", " : "") << *L;
cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int T;
cin >> T;
while (T--) {
int64_t xc, yc, r, x0, y0;
cin >> xc >> yc >> r >> x0 >> y0;
x0 -= xc;
y0 -= yc;
using llf = long double;
if (x0*x0+y0*y0 <= r) {
cout << 0 << '\n';
cout << x0+xc << ' ' << y0+yc << '\n';
continue;
}
llf l = sqrt(x0*x0+y0*y0);
int64_t x = x0 / l * r;
int64_t y = y0 / l * r;
debug(x, y, l);
tuple<int64_t,int64_t,int64_t> ans(1e18, -1, -1);
for (int i = -6; i <= 6; i++)
for (int j = -6; j <= 6; j++) {
if ((x+i)*(x+i) + (y+j)*(y+j) <= r*r) {
int64_t dis = (x+i-x0)*(x+i-x0) + (y+j-y0)*(y+j-y0);
debug(dis);
ans = min(ans, tuple{dis, x+i, y+j});
}
}
auto [_, bx, by] = ans;
cout << 1 << '\n';
cout << x0 + xc << ' ' << y0 + yc << ' ' << bx + xc << ' ' << by + yc << '\n';
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3396kb
input:
3 1 2 1 1 2 3 2 5 -10 3 0 0 1 10 0
output:
0 1 2 1 -10 3 -2 2 1 10 0 1 0
result:
ok correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3404kb
input:
1 0 0 1 0 0
output:
0 0 0
result:
ok correct (1 test case)
Test #3:
score: 0
Accepted
time: 1ms
memory: 3404kb
input:
100 -1 0 2 -3 -2 0 -2 2 -2 0 2 -1 1 0 1 -1 -3 1 -1 0 -1 2 2 -1 -1 2 -2 2 0 -3 -2 -3 2 -3 -2 0 1 2 2 1 -1 0 1 -2 -2 2 -2 2 -1 -2 1 2 2 -2 2 -1 2 1 -1 2 -2 1 2 -3 -2 -1 1 1 -1 1 2 2 1 1 -3 2 0 1 -2 -1 -1 2 1 -2 0 2 -2 2 -2 -1 -2 -2 1 1 -2 -1 1 2 2 1 2 -3 1 0 -1 -3 -3 2 2 -1 2 1 1 -1 1 -3 -2 1 -2 -3 0 ...
output:
1 -3 -2 -2 -1 1 -2 0 -1 -1 1 0 1 1 -1 1 -1 0 -1 -2 1 -1 -1 -1 0 1 0 -3 0 -2 0 -3 -2 1 2 1 2 1 1 -2 -2 -1 -1 1 -1 -2 0 -2 1 -2 2 -1 2 0 -1 2 1 -3 -2 -2 -1 0 -1 1 1 1 -3 2 1 1 -2 -1 1 0 1 -2 0 -1 1 1 -2 -1 0 -2 1 1 -2 -1 -2 1 2 1 1 1 1 0 -1 1 -3 1 2 -1 -1 -3 1 -1 1 1 1 1 -2 -3 -3 -3 1 -2 -2 -2 -2 0 -2...
result:
ok correct (100 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
100 -5 9 1 -2 -7 3 1 6 9 2 -2 -1 2 -7 3 -10 -8 7 -8 6 0 3 9 -6 -7 6 4 9 -1 4 8 6 7 -7 7 3 -7 7 2 0 -5 -1 6 -7 -7 -5 8 7 -9 -6 -6 -5 5 -10 -9 -7 1 9 7 -2 -4 9 4 8 3 3 -9 6 2 -2 -1 -7 3 -8 2 -2 -5 4 -1 0 1 2 9 -5 5 0 9 5 -4 -1 -10 8 2 -3 -7 -8 -3 3 2 -3 3 3 7 -4 6 6 0 6 -3 5 -7 5 9 9 9 2 0 2 8 -10 2 1...
output:
1 -2 -7 -5 8 1 9 2 8 2 1 -7 3 -4 -1 1 -8 6 -10 -1 1 -6 -7 -4 -5 1 -1 4 -1 4 1 -7 7 1 6 1 2 0 2 -1 1 -7 -7 -7 -6 1 -9 -6 -8 2 1 -10 -9 -10 -8 1 7 -2 2 1 1 8 3 -1 7 1 2 -2 3 -3 1 -8 2 -3 -5 1 -1 0 -2 -1 1 -5 5 -5 5 1 -4 -1 -3 5 1 -3 -7 -10 6 1 2 -3 -5 -3 1 -4 6 -3 6 1 -3 5 1 3 1 9 9 1 9 1 8 -10 2 -2 1...
result:
ok correct (100 test cases)
Test #5:
score: -100
Wrong Answer
time: 1ms
memory: 3372kb
input:
100 -52 -13 72 44 58 79 -58 32 60 11 -50 21 75 95 65 -37 -61 21 -74 -40 0 -88 14 11 -49 10 -80 46 79 -17 75 -94 90 61 -34 -80 19 85 -7 -20 -72 42 56 67 -89 21 51 39 20 88 82 32 56 88 -82 3 51 31 -45 -53 50 12 91 9 46 -45 29 25 76 27 -19 -14 81 22 97 5 93 35 98 64 54 90 88 -100 63 -60 -18 81 -20 8 34...
output:
1 44 58 7 28 1 60 11 68 -28 1 95 65 22 42 1 -74 -40 -54 -49 1 11 -49 5 -75 1 79 -17 43 -48 1 61 -34 61 -13 1 -7 -20 -7 -20 1 67 -89 -30 5 1 20 88 20 88 1 88 -82 82 -24 1 -45 -53 -10 23 1 9 46 -14 64 1 76 27 -20 29 1 22 97 9 62 1 98 64 39 85 1 -100 63 -33 77 1 -20 8 1 20 1 62 16 46 51 1 -46 66 -79 -2...
result:
wrong answer the distance of your solution has travelled is longer than expected. (test case 7)