/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 180ms 760.0 KiB
#3 Accepted 252ms 788.0 KiB
#4 Accepted 258ms 936.0 KiB
#5 Time Exceeded ≥1096ms ≥1.359 MiB
#6 Time Exceeded ≥1088ms ≥1.379 MiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sp " "
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl

void messi()
{
    ll n;
    cin >> n;
    vector<ll> v(n);
    for (ll &x : v)
        cin >> x;
    ll q;
    cin >> q;
    while (q--)
    {
        ll a;
        cin >> a;
        ll mn = INT_MAX;
        ll index = 0;
        for (ll i = 0; i < n; i++)
        {
            if (v[i] < mn)
            {
                mn = v[i];
                index = i;
            }
        }
        v[index] = a;
        cout << index + 1 << endl;
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll tc = 1; // cin>>tc;
    while (tc--)
    {
        messi();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1086 KuZ the Position
Contest
Bangladesh 2.0
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-16 16:03:01
Judged At
2024-10-03 13:28:56
Judged By
Score
60
Total Time
≥1096ms
Peak Memory
≥1.379 MiB