Submission #935726

#TimeUsernameProblemLanguageResultExecution timeMemory
935726antonStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
419 ms23956 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pii pair<int, int> signed main(){ int n; cin>>n; vector<pii> st; map<int, int> oc; for(int i = 0; i<n; i++){ int a; cin>>a; if(oc[a] == 0){ st.push_back({a, i}); oc[st.back().first]++; } else{ while(st.size()>0 && st.back().first !=a){ oc[st.back().first]--; st.pop_back(); } st.back().second = i; } } vector<int> res; for(auto e: st){ while(res.size()<=e.second){ res.push_back(e.first); } } for(int i = 0; i<n; i++){ cout<<res[i]<<endl; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:34:25: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   34 |         while(res.size()<=e.second){
      |               ~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...