QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#554850#8332. Two in OneCarroT1212WA 0ms3832kbC++141.1kb2024-09-09 16:37:542024-09-09 16:37:55

Judging History

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

  • [2024-09-09 16:37:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3832kb
  • [2024-09-09 16:37:54]
  • 提交

answer

#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
using namespace std; bool MEM;
using ll=long long; using ld=long double;
using pii=pair<int,int>; using pll=pair<ll,ll>;
const int I=1e9,N=1e5+7;
const ll J=1e18;
int n,a[N],c[N],c1,c2;
int mx,mp,cx,cp;
int ans,al,ar,cl,cr;
void mian() {
	scanf("%d",&n),ans=mx=mp=cx=cp=c1=c2=0;
	for (int i=1;i<=n;i++) c[i]=0;
	for (int i=1;i<=n;i++) scanf("%d",&a[i]),c[a[i]]++;
	if (c[a[1]]==n) return cout<<n<<"\n1 "<<n<<"\n"<<a[1]<<" "<<a[1]<<"\n",void();
	for (int i=1;i<=n;i++) {
		if (c[i]>mx) cx=mx,cp=mp,mx=c[i],mp=i;
		else if (c[i]>cx) cx=c[i],cp=i;
	}
	for (int i=1;i<=n;i++) {
		if (a[i]==mp) c1++;
		else if (a[i]==cp) c2++;
		if ((c1|c2)>ans) ans=c1|c2,al=1,ar=i,cl=mp,cr=cp;
	}
	cout<<ans<<"\n"<<al<<" "<<ar<<"\n"<<cl<<" "<<cr<<"\n";
}
bool ORY; int main() {
//	freopen("ttheal2.in","r",stdin);
//	freopen("ttheal.in","r",stdin);
//	freopen("ttheal.out","w",stdout);
//	while (1)
	int t; for (scanf("%d",&t);t--;)
	mian();
	cerr<<"\n"<<abs(&MEM-&ORY)/1048576<<"MB";
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3832kb

input:

1
7
1 2 3 4 3 2 1

output:

3
1 6
1 2

result:

wrong answer Output contains longer sequence [length = 5], but answer contains 1 elements