Submission #861797

#TimeUsernameProblemLanguageResultExecution timeMemory
861797AiperiiiZalmoxis (BOI18_zalmoxis)C++17
0 / 100
233 ms8016 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define all(x) x.begin(),x.end() #define ff first #define ss second signed main(){ int n,k; cin>>n>>k; vector <int> a(n); map <int,int> mp; for(int i=0;i<n;i++){ cin>>a[i]; mp[a[i]]++; } int val=-1,ins=-1; for(auto x: mp){ if(x.ss==2){ if(mp[x.ff+1]==0){ val=x.ff+1; ins=x.ff; break; } } } for(int i=0;i<n;i++){ if(a[i]==ins && val!=-1){ cout<<val<<" "<<a[i]<<" "; val=-1; } else{ cout<<a[i]<<" "; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...