Just want to get the idea if and who are coming?
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3611 |
| 4 | jiangly | 3583 |
| 5 | strapple | 3515 |
| 6 | tourist | 3470 |
| 7 | Radewoosh | 3415 |
| 8 | Um_nik | 3376 |
| 9 | maroonrk | 3361 |
| 10 | XVIII | 3345 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 162 |
| 2 | adamant | 148 |
| 3 | Um_nik | 146 |
| 4 | Dominater069 | 143 |
| 5 | errorgorn | 141 |
| 6 | cry | 138 |
| 7 | Proof_by_QED | 136 |
| 8 | YuukiS | 135 |
| 9 | chromate00 | 134 |
| 10 | soullless | 133 |
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://mirror.codeforces.com/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 |
|---|


