제출 #1055467

#제출 시각아이디문제언어결과실행 시간메모리
1055467dpsaveslivesStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
109 ms16120 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int N; cin >> N; vector<array<int,3>> vec; multiset<int> ms; for(int i = 0;i<N;++i){ int x; cin >> x; if(ms.find(x) == ms.end()){ ms.insert(x); vec.push_back({x,i,i}); continue; } ms.insert(x); while(!vec.empty() && vec.back()[0] != x){ ms.erase(ms.find(vec.back()[0])); vec.pop_back(); } int ind = vec.back()[1]; ms.erase(ms.find(x)); vec.pop_back(); vec.push_back({x,ind,i}); } for(int i = 0;i<vec.size();++i){ for(int j = vec[i][1];j<=vec[i][2];++j){ cout << vec[i][0] << "\n"; } } return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int i = 0;i<vec.size();++i){
      |                   ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...