QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#235360 | #7695. Double Up | PhantomThreshold# | TL | 0ms | 0kb | C++20 | 712b | 2023-11-02 18:04:51 | 2023-11-02 18:04:52 |
Judging History
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