ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#189284 | #3308. 踹安狗 | heyuzhen | 100 | 440ms | 2772kb | C++11 | 1.1kb | 2023-10-04 09:46:23 | 2023-10-04 12:33:38 |
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,y,x;
bool ok;
struct node{
ll x,p;
bool operator < (const node t) const{
return x < t.x;
}
}a[100005];
int main(){
cin >> n;
for(ll i = 1;i <= n;i++){
cin >> a[i].x;
a[i].p = i;
}sort(a + 1,a + n + 1);
y = n;
while(1){
for(ll i = y;i >= 6;i--){
if(a[i].x < a[i - 1].x + a[i - 5].x)
if(a[i - 2].x < a[i - 3].x + a[i - 4].x){
cout << a[i].p << " " << a[i - 1].p << " ";
cout << a[i - 5].p << " " << a[i - 2].p << " ";
cout << a[i - 3].p << " " << a[i - 4].p;
return 0;
}
if(a[i].x >= a[i - 1].x + a[i - 2].x)y = i;
else break;
}if(ok){
y--;
continue;
}
if(y < 6){
cout << -1;
return 0;
}x = y - 3;
for(ll i = y - 3;i >= 3;i--)
if(a[i].x >= a[i - 1].x + a[i - 2].x)x = i;
else break;
if(x < 3){
y--;
ok = 1;
continue;
}cout << a[y].p << " " << a[y - 1].p << " ";
cout << a[y - 2].p << " " << a[x].p << " ";
cout << a[x - 1].p << " " << a[x - 2].p << " ";
return 0;
}return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1212kb
input:
6 687786726963580 676203373748984 426628665779852 783066834852223 788409887900962 36164560152862
output:
5 4 6 1 2 3
result:
ok ok
Test #2:
score: 10
Accepted
time: 0ms
memory: 1216kb
input:
20 665612175242670 838420208330677 801582841663181 573114053573948 570145522433228 906563303913564 9...
output:
15 14 2 10 6 16
result:
ok ok
Test #3:
score: 10
Accepted
time: 0ms
memory: 1212kb
input:
20 708734287831216 367988866435420 23858950707090 961945282338412 469845558417961 383310964188157 85...
output:
4 13 1 7 14 12
result:
ok ok
Test #4:
score: 10
Accepted
time: 64ms
memory: 2768kb
input:
100000 304796708724720 538498453876439 272022900179513 64771686604312 49795131913528 122642678650576...
output:
22622 54999 33654 75246 24031 52777
result:
ok ok
Test #5:
score: 10
Accepted
time: 60ms
memory: 2772kb
input:
100000 401463590116672 574794159983290 679510855924367 3515016398868 18629359633336 309138826949560 ...
output:
87809 76243 81774 45635 22922 56292
result:
ok ok
Test #6:
score: 10
Accepted
time: 64ms
memory: 2772kb
input:
100000 650414824324366 714620327617695 653497996245891 445204001954703 999391439747463 6263858934366...
output:
27505 22595 16294 59610 55644 55277
result:
ok ok
Test #7:
score: 10
Accepted
time: 64ms
memory: 2772kb
input:
100000 798607481723665 787327190767517 225653256415115 264493391035298 38757884845343 63308908452898...
output:
43704 2022 31306 24722 3286 86099
result:
ok ok
Test #8:
score: 10
Accepted
time: 60ms
memory: 2768kb
input:
100000 222887400037123 380435476311307 506633479487256 695689787367503 225141435774613 8716932685794...
output:
31077 34833 88929 78501 46310 96772
result:
ok ok
Test #9:
score: 10
Accepted
time: 64ms
memory: 2772kb
input:
100000 838952301577456 578873649923363 470539024130216 112846678383640 777480768771310 9418113986474...
output:
6175 58426 85075 151 11997 72534
result:
ok ok
Test #10:
score: 10
Accepted
time: 64ms
memory: 2768kb
input:
100000 1291082298539 329037669036270 339630396492775 140023099135725 423480310453938 842819131899076...
output:
96894 72680 95072 67349 55542 35394
result:
ok ok
Extra Test:
score: 0
Extra Test Passed