Wrong Answer
Code
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
//cin>>t;
//while(t--)
//{
long long n;
cin>>n;
vector<pair<long long,long long>>v(n);
for(int i=0;i<n;i++)
{
long long p;
cin>>p;
v[i]=make_pair(p,i);
}
sort(v.begin(),v.end());
long long q;
cin>>q;
long long minn=10000000000;
long long ind=-1;
long long j=0;
for(int i=0;i<q;i++)
{
long long temp;
cin>>temp;
if(v[j].first<=minn&&j<n)
{
//cout<<"YES"<<endl;
cout<<v[j].second+1<<endl;
if(temp<minn)
{
ind=v[j].second;
}
minn=min(minn,temp);
j++;
}
else
{
cout<<ind+1<<endl;
if(temp<minn)
{
ind=ind;
}
minn=min(temp,minn);
}
}
//}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1086 KuZ the Position
- Contest
- Bangladesh 2.0
- Language
- C++11 (G++ 13.2.0)
- Submit At
- 2024-08-16 17:42:20
- Judged At
- 2024-10-03 13:21:06
- Judged By
- Score
- 50
- Total Time
- 264ms
- Peak Memory
- 2.562 MiB