Submission #909951

#TimeUsernameProblemLanguageResultExecution timeMemory
909951IUA_HasinStone Arranging 2 (JOI23_ho_t1)C++17
35 / 100
38 ms2908 KiB
#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]; ll cnt1 = -1; ll cnt2 = -1; for (int i=0; i<n; i++){ cin>>arr[i]; if(arr[i]==1){ cnt1 = i; } else { cnt2 = i; } } ll a = arr[0]; if(cnt1==-1){ for(int i=0; i<n; i++){ cout<<arr[i]<<endl; } } else if(cnt2==-1){ for(int i=0; i<n; i++){ cout<<arr[i]<<endl; } } else { if(a==1){ for(int i=0; i<n; i++){ if(i<=cnt1){ cout<<1<<endl; } else { cout<<2<<endl; } } } else { for(int i=0; i<n; i++){ if(i<=cnt2){ cout<<2<<endl; } else { cout<<1<<endl; } } } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...