Time Exceeded
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