이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ort ((bas+son)/2)
#define int long long
#define endl "\n"
int n,k,a[150005],ind;
inline bool check(int l,int r,int sum){
int say=0;
while(l<r){
if(a[l]+a[r]==sum){
l++;
r--;
say++;
}
else if(a[l]+a[r]<sum){
ind=l;
l++;
}
else{
ind=r;
r--;
}
}
if(say==n/2)return 1;
return 0;
}
int32_t main(void){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n>>k;
for(int i=1;i<=n;i++)cin>>a[i];
if(check(1,n,a[1]+a[n])){
for(int i=1;i<ind;i++)cout<<i<<" ";
for(int i=ind+1;i<=n;i++)cout<<i<<" ";
return 0;
}
if(check(1,n-1,a[1]+a[n-1])){
for(int i=1;i<n;i++)cout<<i<<" ";
return 0;
}
if(check(2,n,a[2]+a[n])){
for(int i=2;i<=n;i++)cout<<i<<" ";
return 0;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |