제출 #930068

#제출 시각아이디문제언어결과실행 시간메모리
930068EJIC_B_KEDAXStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
156 ms17092 KiB
#ifdef LOCAL #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> #ifndef LOCAL // #pragma GCC optimize("O3") // #pragma GCC optimize("Ofast") // #pragma GCC optimize("unroll-loops") // #pragma GCC target("avx,avx2,bmi,bmi2,popcnt,lzcnt") #endif using namespace std; using ll = long long; using ld = long double; #define x first #define y second #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() mt19937_64 mt(time(0)); void solve(); void init(); int32_t main() { #ifndef LOCAL cin.tie(nullptr)->sync_with_stdio(false); #endif cout << fixed << setprecision(30); init(); int t = 1; // cin >> t; while (t--) { solve(); } } void init() {} void solve() { int n; cin >> n; vector<int> a(n), b; vector<pair<int, int>> seg; map<int, int> mp; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { if (mp[a[i]] == 0) { mp[a[i]]++; seg.emplace_back(i, i); b.push_back(a[i]); } else { while (b.back() != a[i]) { mp[b.back()]--; seg.pop_back(); b.pop_back(); } seg.back().y = i; } } for (int i = 0; i < b.size(); i++) { for (int j = seg[i].x; j <= seg[i].y; j++) { cout << b[i] << '\n'; } } }

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

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