Submission #1333220

#TimeUsernameProblemLanguageResultExecution timeMemory
1333220herissonwowwStone Arranging 2 (JOI23_ho_t1)C++20
25 / 100
2094 ms1092 KiB
#include <iostream>

using namespace std;

int main()
{
    int n; cin >> n;
    int stones[n];
    for(int i = 0; i < n; i++){
        int color; cin >> color;
        stones[i] = color;
        int lastc = -1;
        for(int j = 0; j < i; j++){
            if(stones[j] == color)
                lastc = j;
        }
        if(lastc==-1)
            continue;
        for(int j = lastc; j < i; j++){
            stones[j] = color;
        }
    }
    for(int i : stones)
        cout << i << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...