QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#149653#6348. Egor Has a Problemqzez#TL 50ms7692kbC++141.1kb2023-08-25 07:23:522023-08-25 07:23:53

Judging History

你现在查看的是最新测评结果

  • [2023-08-25 07:23:53]
  • 评测
  • 测评结果:TL
  • 用时:50ms
  • 内存:7692kb
  • [2023-08-25 07:23:52]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<typename T>
ostream& operator << (ostream &out,const vector<T>&x){
	if(x.empty())return out<<"[]";
	out<<'['<<x[0];
	for(int len=x.size(),i=1;i<len;i++)out<<','<<x[i];
	return out<<']';
}
template<typename T>
vector<T> ary(const T *a,int l,int r){
	return vector<T>{a+l,a+1+r};
}
template<typename T>
void debug(T x){
	cerr<<x<<'\n';
}
template<typename T,typename ...S>
void debug(T x,S ...y){
	cerr<<x<<' ',debug(y...);
}
const int N=5e5+10;
int n;
ll a[N];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	int id=0;
	for(int i=2;i<=n;i++){
		if(a[i]/a[i-1]==1){
			if(id&&id+1<i){
				cout<<"YES\n"<<id-1<<' '<<id<<' '<<i-1<<' '<<i<<endl;
				return 0;
			}
			id=i;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			for(int p=j+1;p<=n;p++){
				for(int q=p+1;q<=n;q++){
					if(a[j]/a[i]==a[q]/a[p]){
						cout<<"YES\n"<<i<<' '<<j<<' '<<p<<' '<<q<<endl;
						return 0;
					}
				}
			}
		}
	}
	cout<<"NO\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3608kb

input:

6
2 6 11 21 47 120

output:

YES
1 3 4 6

result:

ok OK

Test #2:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

5
1 2 6 30 210

output:

NO

result:

ok OK

Test #3:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

4
7 13 77 143

output:

YES
1 2 3 4

result:

ok OK

Test #4:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

4
10 29 31 100

output:

NO

result:

ok OK

Test #5:

score: 0
Accepted
time: 37ms
memory: 7692kb

input:

500000
627045176858 4817409059014 6288122580263 11138485427254 14292718094002 14799874839768 16926890883539 17617152313162 17645472255619 18208915248631 22963632241827 24466999302606 25551903318615 26091633648017 38200644379849 39885775205129 40036378248650 40309675851194 40773414900416 408933438176...

output:

YES
1 2 3 21

result:

ok OK

Test #6:

score: 0
Accepted
time: 49ms
memory: 7688kb

input:

500000
4296317198460 9088530306835 12761569474357 16261038279090 16941085611205 18350614838717 22480413215272 23329628179141 24312311764761 24433929342173 27221427530427 28176763451413 28796907935821 30472998712185 32522454545697 33716639435084 36803789739537 36820525380957 39761789956892 4078696306...

output:

YES
1 2 3 11

result:

ok OK

Test #7:

score: 0
Accepted
time: 50ms
memory: 7504kb

input:

500000
2486629253945 2653364744556 4284488165789 4329370039939 4642065503681 6901749347495 19192137130640 21230142707219 21572527039148 22380596790669 24549580468932 24705234465366 24809017205084 25372640950744 30936948747149 31605133106641 35382503368540 36668459004194 39297585189262 40441705410326...

output:

YES
5 6 7 8

result:

ok OK

Test #8:

score: 0
Accepted
time: 45ms
memory: 7512kb

input:

500000
1212707463644 3060808785468 5253681005592 6636218910647 8688761397981 9169130038833 9604296507161 10581672897486 14606712594653 18215478522408 19985113657583 21876858531698 22009681507073 25744252327149 29854713235059 30049643326503 35465827651805 38437058489989 40205415453241 42389564776077 ...

output:

YES
1 2 3 8

result:

ok OK

Test #9:

score: -100
Time Limit Exceeded

input:

500000
1 999999999999500002 999999999999500003 999999999999500004 999999999999500005 999999999999500006 999999999999500007 999999999999500008 999999999999500009 999999999999500010 999999999999500011 999999999999500012 999999999999500013 999999999999500014 999999999999500015 999999999999500016 999999...

output:


result: