| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1333234 | herissonwoww | Stone Arranging 2 (JOI23_ho_t1) | C++20 | 28 ms | 1440 KiB |
#include <iostream>
using namespace std;
int main()
{
int n; cin >> n;
int stones[n];
bool flag = true;
if(n<=2000){
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;
}
int first1 = -1;
int first2 = -1;
for(int i = 0; i < n; i++){
int color; cin >> color;
if(color == 1){
if(first1==-1)
first1 = i;
}
else{
if(first2==-1)
first2 = i;
}
stones[i] = color;
if(color > 2)
flag = false;
}
if(flag){
int pr = stones[n-1];
if(pr==1){
if(first1!=-1)
for(int i = first1; i < n; i++){
stones[i] = 1;
}
}
else{
if(first2!=-1){
for(int i = first2; i < n; i++){
stones[i] = 2;
}
}
}
for(int i : stones)
cout << i << '\n';
}
//1 3 4 1 2 3 7 3 4 7 2 1
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
