Submission #937602

#TimeUsernameProblemLanguageResultExecution timeMemory
937602tw20000807Stone Arranging 2 (JOI23_ho_t1)C++17
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> #define int long long using namespace std; signed main(){ int n; cin >> n; map<int, int> mp; vector< int > v(n), tag(n); int last = 0; for(int i = 0; i < n; ++i){ cin >> v[i]; if(mp.count(v[i])){ tag[i] = mp[v[i]]; } else{ tag[i] = i; } mp[v[i]] = i; } for(int i = n - 1; i >= 0; --i){ for(int j = i; j >= tag[i]; --j){ v[j] = v[i]; } i = tag[i]; } for(auto &i : v) cout << i << "\n"; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:11:6: warning: unused variable 'last' [-Wunused-variable]
   11 |  int last = 0;
      |      ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...