This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
//TO BE OPTIMIZED -> too much time (3 for loops);
using namespace std;
int main(){
long long n; cin >> n;
int arr[n];
//int col = -1; //current color
for(int i=0;i<n;i++){
cin >> arr[i];
}
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if(arr[i] == arr[j]){
for(int l=i;l<j;l++){
arr[l] = arr[i];
}
}
}
}
for(int i=0;i<n;i++){
cout << arr[i] << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |