ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#189289 | #3308. 踹安狗 | zxl | 100 | 152ms | 2728kb | C++ | 2.8kb | 2023-10-04 09:47:26 | 2023-10-04 12:33:47 |
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
const int N = 1e5 + 50;
const int M = 1e5 + 50;
const int Mod = 1e9 + 7;
#define int long long
inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
int n, m;
struct node
{
int v, id;
} ax[N];
bool cmp(node x, node y)
{
return x.v < y.v;
}
bool flag = 0;
void print(int a, int b, int c, int d, int e, int f)
{
printf("%lld %lld %lld %lld %lld %lld", a, b, c, d, e, f);
}
bool check(int a, int b, int c, int d, int e, int f, int p1, int p2, int p3, int p4, int p5, int p6)
{
int ap = ax[p1].id, bp = ax[p2].id, cp = ax[p3].id, dp = ax[p4].id, ep = ax[p5].id, fp = ax[p6].id;
if (a < b + c && d < e + f)
{
print(ap, bp, cp, dp, ep, fp);
return true;
}
if (a < b + d && c < e + f)
{
print(ap, bp, dp, cp, ep, fp);
return true;
}
if (a < b + e && c < d + f)
{
print(ap, bp, ep, cp, dp, fp);
return true;
}
if (a < b + f && c < d + e)
{
print(ap, bp, fp, cp, dp, ep);
return true;
}
if (a < c + d && b < e + f)
{
print(ap, cp, dp, bp, ep, fp);
return true;
}
if (a < c + e && b < d + f)
{
print(ap, cp, ep, bp, dp, fp);
return true;
}
if (a < c + f && b < d + e)
{
print(ap, cp, fp, bp, dp, ep);
return true;
}
if (a < d + e && b < c + f)
{
print(ap, dp, ep, bp, cp, fp);
return true;
}
if (a < d + f && b < c + e)
{
print(ap, dp, fp, bp, cp, ep);
return true;
}
if (a < e + f && b < c + d)
{
print(ap, ep, fp, bp, cp, dp);
return true;
}
return false;
}
signed main()
{
// freopen("in.in", "r", stdin);
n = read();
for (int i = 1; i <= n; ++i)
ax[i].v = read(), ax[i].id = i;
sort(ax + 1, ax + n + 1, cmp);
// cout << (a[n] < a[n - 1] + a[n - 2]) << "-" << (a[n - 3] < a[n - 4] + a[n - 5]) << endl;
for (int i = n; i >= 6; i--)
{
// if (a[i] >= a[i - 1] + a[i - 2])
// continue;
if (!check(ax[i].v, ax[i - 1].v, ax[i - 2].v, ax[i - 3].v, ax[i - 4].v, ax[i - 5].v, i, i - 1, i - 2, i - 3, i - 4, i - 5))
continue;
// printf("\n%d %d %d %d %d %d", i, i - 1, i - 2, i - 3, i - 4, i - 5);
flag = 1;
return 0;
}
if (!flag)
{
puts("-1");
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
6 687786726963580 676203373748984 426628665779852 783066834852223 788409887900962 36164560152862
output:
5 4 3 1 2 6
result:
ok ok
Test #2:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
20 665612175242670 838420208330677 801582841663181 573114053573948 570145522433228 906563303913564 9...
output:
15 14 10 6 16 2
result:
ok ok
Test #3:
score: 10
Accepted
time: 0ms
memory: 1168kb
input:
20 708734287831216 367988866435420 23858950707090 961945282338412 469845558417961 383310964188157 85...
output:
4 13 7 14 12 1
result:
ok ok
Test #4:
score: 10
Accepted
time: 23ms
memory: 2728kb
input:
100000 304796708724720 538498453876439 272022900179513 64771686604312 49795131913528 122642678650576...
output:
22622 54999 75246 24031 52777 33654
result:
ok ok
Test #5:
score: 10
Accepted
time: 23ms
memory: 2724kb
input:
100000 401463590116672 574794159983290 679510855924367 3515016398868 18629359633336 309138826949560 ...
output:
87809 76243 45635 22922 56292 81774
result:
ok ok
Test #6:
score: 10
Accepted
time: 20ms
memory: 2724kb
input:
100000 650414824324366 714620327617695 653497996245891 445204001954703 999391439747463 6263858934366...
output:
27505 22595 59610 55644 55277 16294
result:
ok ok
Test #7:
score: 10
Accepted
time: 17ms
memory: 2724kb
input:
100000 798607481723665 787327190767517 225653256415115 264493391035298 38757884845343 63308908452898...
output:
43704 2022 24722 3286 86099 31306
result:
ok ok
Test #8:
score: 10
Accepted
time: 23ms
memory: 2728kb
input:
100000 222887400037123 380435476311307 506633479487256 695689787367503 225141435774613 8716932685794...
output:
31077 34833 78501 46310 96772 88929
result:
ok ok
Test #9:
score: 10
Accepted
time: 23ms
memory: 2724kb
input:
100000 838952301577456 578873649923363 470539024130216 112846678383640 777480768771310 9418113986474...
output:
6175 58426 151 11997 72534 85075
result:
ok ok
Test #10:
score: 10
Accepted
time: 23ms
memory: 2728kb
input:
100000 1291082298539 329037669036270 339630396492775 140023099135725 423480310453938 842819131899076...
output:
96894 72680 67349 55542 35394 95072
result:
ok ok
Extra Test:
score: 0
Extra Test Passed