제출 #862117

#제출 시각아이디문제언어결과실행 시간메모리
862117HanksburgerStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
147 ms15308 KiB
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > vec; map<int, int> mp; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i=1; i<=n; i++) { int x; cin >> x; if (mp[x]) { int sum=0; while (vec.back().first!=x) { sum+=vec.back().second; mp[vec.back().first]--; vec.pop_back(); } vec.back().second+=sum+1; } else { vec.push_back({x, 1}); mp[x]++; } } for (int i=0; i<vec.size(); i++) for (int j=0; j<vec[i].second; j++) cout << vec[i].first << '\n'; }

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

Main.cpp: In function 'int main()':
Main.cpp:33:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     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...