제출 #495456

#제출 시각아이디문제언어결과실행 시간메모리
495456couplefireFloppy (RMI20_floppy)C++17
100 / 100
112 ms13344 KiB
#include "floppy.h"
#include <bits/stdc++.h>
using namespace std;

void read_array(int sid, const vector<int>& v){
    string res = ""; int n = v.size();
    vector<int> st;
    for(int i = 0; i<n; ++i){
        while(st.size() && v[i]>v[st.back()])
            res += '0', st.pop_back();
        st.push_back(i); res += '1';
    } save_to_floppy(res);
}

vector<int> solve_queries(int sid, int n, const string& bits, const vector<int> &a, const vector<int> &b){
    int m = a.size();
    vector<vector<int>> huh(n);
    for(int i = 0; i<m; ++i)
        huh[b[i]].push_back(i);
    vector<int> ans(m), st;
    for(int i = 0, it = 0; i<n; ++i){
        while(bits[it]=='0') st.pop_back(), ++it;
        st.push_back(i); ++it;
        for(auto x : huh[i])
            ans[x] = *lower_bound(st.begin(), st.end(), a[x]);
    } return ans;
}

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

stub.cpp: In function 'void run2()':
stub.cpp:101:30: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  101 |     if (query_answers.size() != M) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...