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 <bits/stdc++.h>
#define endl "\n"
#define finp for(int i=0; i<n; i++)
#define fknp for(int k=0; k<n; k++)
#define yeap cout<<"YES"<<endl
#define nope cout<<"NO"<<endl
#define inpintn int n; cin>>n
#define inpintarrn int arr[n]; for(int i=0; i<n; i++){cin>>arr[i];}
#define inpllarrn long long arr[n]; for(int i=0; i<n; i++){cin>>arr[i];}
#define ll long long
using namespace std;
int main ()
{
ll n;
cin>>n;
ll arr[n];
for (int i=0; i<n; i++){
cin>>arr[i];
}
ll a = arr[0];
ll cnta = 0;
ll cntaa = 0;
if(n==1){
cout<<a<<endl;
} else {
while(cnta<n-1){
cntaa = cnta;
a = arr[cnta];
for (int i=cnta; i<n; i++){
if(arr[i]==a){
cnta = i;
}
}
for(int i=cntaa; i<=cnta; i++){
cout<<a<<endl;
}
cnta = cnta + 1;
// if(cnta>=n-1){
// break;
// }
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |