Submission #740617

#TimeUsernameProblemLanguageResultExecution timeMemory
740617brunnorezendesStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
283 ms17424 KiB
#include <bits/stdc++.h>

using namespace std;

int main(){
    int N,a;
    cin>>N;
    vector<int> v;
    set<pair<int,int>> pos;
    vector<pair<int,pair<int,int>>> vf;
    for (int i = 0; i<N; i++){
        cin>>a;
        v.push_back(a);
        pos.insert({a,i});
    }
    for( int i = 0; i < N; i ++){
        auto tmp = pos.lower_bound({v[i], N+1});
        tmp--;
        vf.push_back({v[i],{i,(*tmp).second}});
        i = tmp->second;
    }
    for(int i = 0; i < vf.size(); i++){
        for(int j = 0; j <= vf[i].second.second - vf[i].second.first; j++)
            cout<<vf[i].first<<"\n";
    }
    return 0;
}

Compilation message (stderr)

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