Submission #861959

#TimeUsernameProblemLanguageResultExecution timeMemory
861959JakobZorzStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
147 ms14568 KiB
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<limits.h> #include<math.h> #include<map> #include<set> #include<unordered_map> #include<unordered_set> #include<iomanip> typedef long long ll; typedef long double ld; using namespace std; const int MOD=1e9+7; //typedef pair<ll,ll>Point; //typedef pair<ll,ll>Line; //#define x first //#define y second int main(){ ios::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL); //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); int n; cin>>n; vector<int>arr(n); multiset<int>s; for(int&i:arr){ cin>>i; s.insert(i); } for(int i=0;i<n;){ s.erase(s.find(arr[i])); if(s.find(arr[i])!=s.end()){ int val=arr[i]; i++; while(arr[i]!=val){ s.erase(s.find(arr[i])); arr[i++]=val; } }else i++; } for(int i:arr) cout<<i<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...