Just want to get the idea if and who are coming?
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3382 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 155 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 145 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 134 |
| 9 | maroonrk | 132 |
| 10 | cry | 130 |
Just want to get the idea if and who are coming?
I was participating in meta hacker cup as practice round is going on now. But for 2/3 questions for which the submissions i made i got presentation error. And at this point i am not able to figure out much what were the difference between them. So can someone tell me how to handle this so i don't mess up because of this.(As the contest is still going on i am not sure if i should share my code here but if someone wants i can share it to him/her personally).
Edit: One thing which i forgot to mention i solved some problems from last year as well and all those question which had single line output like "Case #1: 5" these tend to work fine but only those which had multiple lines output seem to fail(Not sure if that's the correct reasoning or not).
https://codeforces.me/contest/2031/problem/D Problem link.
ll n;
cin>>n;
ll arr[n];
vector<ll> gret(n);
map <ll,ll,greater<ll>> mp;
for(int i=0;i<n;i++){
cin>>arr[i];
gret[i]=arr[i];
if(i>0)
gret[i]=max(gret[i],gret[i-1]);
if(mp.find(arr[i])==mp.end())
mp[arr[i]]=i;
}
auto it=mp.begin();
ll cnt=0;
ll mi=it->first;
ll ans[n];
int i=it->second,la=n;
while(cnt<n){
int q=i;
for(;i<la;i++){
ans[i]=it->first;
mi=min(mi,arr[i]);
cnt++;
}
la=q;
if(cnt==n)
break;
int k=upper_bound(gret.begin(),gret.end(),mi)-gret.begin();
if(mi==it->first || gret[k]==it->first){
it=mp.find(gret[la-1]);
i=it->second;
}
else{
i=k;
}
}
for(int j=0;j<n;j++)
cout<<ans[j]<<" ";
cout<<endl;This is the code. I am not able to get why I am getting TLE when the code complexity should be O(nlogn) which should be acceptable?
| Name |
|---|


