Submission #1059194

#TimeUsernameProblemLanguageResultExecution timeMemory
1059194beaconmcStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
297 ms18552 KiB
#include <bits/stdc++.h> typedef long long ll; #define FOR(i,x,y) for(ll i=x; i<y; i++) #define FORNEG(i,x,y) for(ll i=x; i>y; i--) using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; vector<ll> vals(n); map<ll,ll> last; FOR(i,0,n){ ll temp; cin >> temp; vals[i] = (temp); last[temp] = i; } ll cur = -1; FOR(i,0,n){ if (cur==-1) cur = vals[i]; if (vals[i] == cur && last[vals[i]] == i) cur = -1; else vals[i] = cur; } for (auto&i : vals) cout << i << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...