/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 216ms 736.0 KiB
#3 Accepted 521ms 912.0 KiB
#4 Accepted 519ms 924.0 KiB
#5 Time Exceeded ≥1081ms ≥944.0 KiB
#6 Time Exceeded ≥1072ms ≥940.0 KiB

Code

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int N, Q;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    cin >> Q;

    for (int i = 0; i < Q; i++) {
        int X;
        cin >> X;

        // Find the index of the minimum value
        int minIndex = 0;
        for (int j = 1; j < N; j++) {
            if (A[j] < A[minIndex]) {
                minIndex = j;
            }
        }

        // Print the position of the minimum value
        cout << minIndex + 1 << endl;

        // Replace the minimum value with X
        A[minIndex] = X;
    }

    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:59:02
Judged At
2024-11-11 03:13:12
Judged By
Score
60
Total Time
≥1081ms
Peak Memory
≥944.0 KiB