QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#318738 | #5894. Aerobics | sharaelong | 0 | 4ms | 3628kb | C++17 | 1.8kb | 2024-01-31 18:44:22 | 2024-01-31 18:44:22 |
answer
#include <bits/stdc++.h>
#ifdef SHARAELONG
#include "../../cpp-header/debug.hpp"
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
void solve() {
int n, w, l;
cin >> n >> w >> l;
// bool swapped = false;
// if (w < l) {
// swap(w, l);
// swapped = true;
// }
vector<int> arr(n);
for (int& r: arr) cin >> r;
sort(arr.rbegin(), arr.rend());
int h = 0;
vector<pii> ans;
int cur = 0;
while (cur < n) {
int R = arr[cur];
int accum = R;
ans.push_back({ 0, h });
cur++;
while (cur < n && accum + arr[cur] <= w) {
int x = accum + arr[cur];
int y = h + arr[cur];
ans.push_back({ x, h });
accum += 2*arr[cur];
cur++;
while (cur < n && y + 2*arr[cur] <= min(l, h+R)) {
ans.push_back({ x, y+arr[cur] });
y += 2*arr[cur];
cur++;
}
}
if (cur < n) h += R + arr[cur];
}
for (int i=0; i<n; ++i) {
for (int j=i+1; j<n; ++j) {
auto[x1, y1] = ans[i];
auto[x2, y2] = ans[j];
ll dsq = (ll)(x1-x2)*(x1-x2) + (ll)(y1-y2)*(y1-y2);
assert(dsq >= (ll)(arr[i]+arr[j])*(arr[i]+arr[j]));
}
}
for (int i=0; i<n; ++i) {
auto[x, y] = ans[i];
assert(0 <= x && x <= w && 0 <= y && y <= l);
// if (swapped) swap(x, y);
cout << x << ' ' << y;
if (i < n-1) cout << ' ';
}
cout << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int cases;
cin >> cases;
for (int tc=1; tc<=cases; ++tc) {
cout << "Case #" << tc << ": ";
solve();
}
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3620kb
input:
50 2 6 6 1 1 3 320 2 4 3 2 10 1252676 1252676 99944 99995 99916 99921 99977 99929 99919 99930 99999 99960 10 100000 1570811 105 97 98 98 104 105 105 100000 105 97 1 215776 215776 53944 10 1000000000 1000000000 99983 99959 99994 99976 99993 99988 99987 99949 99985 99906 10 697173 1215050 82178 88482 ...
output:
Case #1: 0 0 2 0 Case #2: 0 0 7 0 12 0 Case #3: 0 0 199994 0 399966 0 599903 0 799807 0 999681 0 1199540 0 0 199920 199840 199920 399675 199920 Case #4: 0 0 0 100105 210 100105 420 100105 630 100105 839 100105 1041 100105 1237 100105 1432 100105 1626 100105 Case #5: 0 0 Case #6: 0 0 199987 0 399968 ...
result:
wrong answer wrong plan, person 6 and 5 are too close! (test case 3)
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 4ms
memory: 3628kb
input:
50 2 6 6 1 1 3 320 2 4 3 2 1000 12526937 12526937 99982 99941 99939 99945 99919 99956 99992 99974 99906 99975 99930 99942 99913 99935 99944 99950 99974 99933 99967 99936 99972 99909 99966 99976 99994 99952 99950 99957 99957 99918 99968 99985 99939 99933 99919 99915 99924 99933 99984 99910 99993 9991...
output:
Case #1: 0 0 2 0 Case #2: 0 0 7 0 12 0 Case #3: 0 0 200000 0 400000 0 600000 0 800000 0 1000000 0 1200000 0 1400000 0 1600000 0 1800000 0 2000000 0 2199999 0 2399997 0 2599995 0 2799993 0 2999991 0 3199989 0 3399987 0 3599985 0 3799983 0 3999981 0 4199979 0 4399977 0 4599975 0 4799972 0 4999968 0 51...
result:
wrong answer wrong plan, person 77 and 76 are too close! (test case 3)