# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
917631 | envifly | Stone Arranging 2 (JOI23_ho_t1) | C++17 | 204 ms | 14692 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#ifndef LOCAL
#define debug(...) 0
#else
#include "C:\programmingfunnyxd\debug.cpp"
#endif
using namespace std;
const int MOD = 1e9 + 7;
using ll = long long;
#define all(x) x.begin(), x.end()
void solve(){
int n; cin >> n;
map<int, int> last;
vector<int> a(n);
for(int i = 0; i < n; i++){
cin >> a[i];
last[a[i]] = i;
}
// the biggest segment reigns supreme
for(int i = 0; i < n; i++){
for(int j = i; j <= last[a[i]]; j++){
cout << a[i] << "\n";
}
i = last[a[i]];
}
}
int main(){
cin.tie(0) -> sync_with_stdio(0);
int T = 1;
// cin >> T;
while(T--) solve();
}
/* /\_/\
* (= ._.)
* / > \>
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |