/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 178ms 744.0 KiB
#3 Accepted 340ms 884.0 KiB
#4 Accepted 364ms 940.0 KiB
#5 Time Exceeded ≥1089ms ≥2.094 MiB
#6 Time Exceeded ≥1096ms ≥2.086 MiB

Code

#include <bits/stdc++.h>
#define fast() ios::sync_with_stdio(false); cin.tie(0);

using namespace std;
#define ll long long int
#define ft first
#define se second

int main() {
    fast();
    ll N;
    cin >> N;
    vector<pair<ll, ll>> v(N);

    for (ll i = 0; i < N; i++) {
        cin >> v[i].first;
        v[i].second = i + 1;
    }
    sort(v.begin(), v.end());

    ll Q;
    cin >> Q;

    while (Q--) {
        ll X;
        cin >> X;
        cout << v[0].second << endl;
        v[0].first = X;
        ll i = 0;
        while (i + 1 < N && v[i].first > v[i + 1].first) {
            swap(v[i], v[i + 1]);
            i++;
        }
    }

    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:07:34
Judged At
2024-11-11 03:15:55
Judged By
Score
60
Total Time
≥1096ms
Peak Memory
≥2.094 MiB