제출 #1181811

#제출 시각아이디문제언어결과실행 시간메모리
1181811pythontestStone Arranging 2 (JOI23_ho_t1)C++20
60 / 100
2096 ms12148 KiB
#include <iostream>
#include <unordered_map>
constexpr int N=2e5+10;
int kolorki[N];
using namespace std;
unordered_map<int,int> indeksy;
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&kolorki[i]);
        if(indeksy[kolorki[i]]!=0){
            for(int j=indeksy[kolorki[i]];j<i;j++) {
                indeksy[kolorki[j]]=0;
                kolorki[j]=kolorki[i];
            }
        }
        indeksy[kolorki[i]]=i;
    }
    for(int i=1;i<=n;i++) printf("%d\n",kolorki[i]);
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
Main.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d",&kolorki[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...