QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#235360#7695. Double UpPhantomThreshold#TL 0ms0kbC++20712b2023-11-02 18:04:512023-11-02 18:04:52

Judging History

This is the latest submission verdict.

  • [2023-11-02 18:04:52]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 0kb
  • [2023-11-02 18:04:51]
  • Submitted

answer

#include <bits/stdc++.h>
#define ll long long
//#define int long long
using namespace std;

const int maxn = 2100;
inline void read(__int128 &x)
{
	char c; while(!((c=getchar())>='0'&&c<='9'));
	x=c-'0';
	while((c=getchar())>='0'&&c<='9') (x*=10)+=c-'0';
}
int o[maxn],on;
inline void output(__int128 x)
{
	on=0;
	while(x) o[++on]=x%10,x/=10;
	for(int i=on;i>=1;i--) cout<<o[i];
	cout<<'\n';
}

int n;
__int128 a[maxn];

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>n;
	for(int i=1;i<=n;i++) 
	{
		read(a[i]);
	}
	
	while(n>1)
	{
		sort(a+1,a+n+1,greater<__int128>());
		if(a[n]==a[n-1]) a[n-1]<<=1;
		n--;
	}
	output(a[1]);
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

5
4 2 2 1 8

output:


result: