Submission #1175308

#TimeUsernameProblemLanguageResultExecution timeMemory
1175308nagibatorStone Arranging 2 (JOI23_ho_t1)C++20
25 / 100
2094 ms3396 KiB
#include <bits/stdc++.h>
#define nn '\n'
#pragma GCC optimize("O3")
#define int long long
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native")
#define pb push_back
#define all(x) x.begin(), x.end()
#define sec second
#define vec std::vector
const int N = 5e5 + 7;
const int mod = 1e9 + 7;
using namespace std;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vec<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vec<int> res = a;
    for (int i = 0; i < n; i++) {
        int ok=0;
        for(int j = 0; j < i;j++){
            if(res[j] == a[i] && !ok){
                ok = 1;
                continue;
            }
            if(ok ){
                res[j] = a[i];
            }
        }
    }
    for (auto it : res) {
        cout << it << nn;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...