/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 328.0 KiB
#2 Accepted 131ms 736.0 KiB
#3 Accepted 363ms 932.0 KiB
#4 Accepted 369ms 948.0 KiB
#5 Time Exceeded ≥1041ms ≥2.09 MiB
#6 Time Exceeded ≥1073ms ≥2.098 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-10-03 13:28:30
Judged By
Score
60
Total Time
≥1073ms
Peak Memory
≥2.098 MiB