제출 #924046

#제출 시각아이디문제언어결과실행 시간메모리
924046SunbaeStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
95 ms16836 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int A[N], m; vector<int>C, V[N]; int pos(int x){return lower_bound(C.begin(), C.end(), x) - C.begin();} signed main(){ int n; scanf("%d", &n); for(int i = 0; i<n; ++i) scanf("%d", A+i), C.push_back(A[i]); sort(C.begin(), C.end()); C.resize(unique(C.begin(), C.end()) - C.begin()); m = C.size(); for(int i = 0; i<n; ++i) A[i] = pos(A[i]); for(int i = 0; i<n; ++i) V[A[i]].push_back(i); for(int l = 0, r = -1; l<n && r<n; ){ l = r + 1; r = V[A[l]].back(); for(int j = l; j<=r; ++j) printf("%d\n", C[A[l]]); } }

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

Main.cpp: In function 'int main()':
Main.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  int n; scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
Main.cpp:9:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  for(int i = 0; i<n; ++i) scanf("%d", A+i), C.push_back(A[i]);
      |                           ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...