/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 536.0 KiB
#2 Wrong Answer 16ms 1.941 MiB
#3 Wrong Answer 16ms 1.906 MiB
#4 Wrong Answer 17ms 2.008 MiB
#5 Accepted 33ms 2.598 MiB
#6 Accepted 36ms 2.422 MiB

Code

/*
Bismillahir Rahmanir Rahim
(In the name of Allah)

@Author Muhammad Nadim
*/

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define CheckBit(x, k) (x & (1LL << k))
#define SetBit(x, k) (x |= (1LL << k))
#define ClearBit(x, k) (x &= ~(1LL << k))
#define LSB(mask) __builtin_ctzll(mask)
#define MSB(mask) 63 - __builtin_clzll(mask)
#define print(x) cout << #x << " : " << x << endl
#define error1(x) cerr << #x << " = " << (x) << endl
#define coutall(v)         \
    for (auto &it : v)     \
        cout << it << ' '; \
    cout << endl
#define Abid_52                  \
    ios::sync_with_stdio(false); \
    cin.tie(0), cin.tie(0)
#define error2(a, b) cerr << "( " << #a << " , " << #b << " ) = ( " << (a) << " , " << (b) << " )\n"
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()
template <typename T, typename U>
T ceil(T x, U y) { return (x > 0 ? (x + y - 1) / y : x / y); }
template <typename T, typename U>
T floor(T x, U y) { return (x > 0 ? x / y : (x - y + 1) / y); }

#define ld long double
#define nl '\n'
#define pi acos(-1.0)
#define sp(n) fixed << setprecision(n)
#define MNTDH_18                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define yes cout << "YES" << "\n"
#define no cout << "NO" << "\n"
// #define all(v) v.begin(), v.end()
#define CheckBit(x, k) (x & (1LL << k))
#define SetBit(x, k) (x |= (1LL << k))
#define ClearBit(x, k) (x &= ~(1LL << k))
#define LSB(mask) __builtin_ctzll(mask)
#define MSB(mask) 63 - __builtin_clzll(mask)

// template <typename T, typename U>
// T ceil(T x, U y) { return (x > 0 ? (x + y - 1) / y : x / y); }
// template <typename T, typename U>
// T floor(T x, U y) { return (x > 0 ? x / y : (x - y + 1) / y); }

// typedef  __int128 lll;
typedef struct rafi
{
    ll type;
    ll idx1;
    ll idx2;
} R;

typedef struct sajeeb
{
    ll val1;
    ll val2;
} S;

typedef struct ohi
{
    ll l;
    ll r;
    ll u;
    ll d;
    int val;
} O;

const int N = 2e5 + 7, M = 1073741824, N1 = 64;
bool isPowerOfTwo(int n)
{
    if (n == 0)
        return false;

    return (ceil(log2(n)) == floor(log2(n)));
}

bool comp(S a, S b)
{
    if(a.val1<b.val1)   return 1;
    return 0;
}
void sF()
{
    ll n, x, idx=0, minVal;
    cin>>n;
    
    S a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i].val1;
        a[i].val2=i+1;
    }
    sort(a, a+n, comp);
    
    //minVal=a[idx].val1;
    
    ll q;
    cin>>q;
    
    while(q--)
    {
        cin>>x;
        cout<<a[idx].val2<<nl;
        
        if(x>a[idx].val1)
        {
            idx++;
        }
        
    }
}

int main()
{
    MNTDH_18
    // pow2();

    ll tc = 1, x = 1;
    //cin >> tc;

    while (tc--)
    {
        // cout << "Case " << x++ << ": ";
        sF();
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1086 KuZ the Position
Contest
Bangladesh 2.0
Language
C++17 (G++ 13.2.0)
Submit At
2024-08-16 16:05:25
Judged At
2024-10-03 13:28:43
Judged By
Score
50
Total Time
36ms
Peak Memory
2.598 MiB