답안 #947023

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
947023 2024-03-15T10:55:30 Z thunopro Floppy (RMI20_floppy) C++14
100 / 100
77 ms 13684 KB
#include <bits/stdc++.h>
#include "floppy.h"
 
using namespace std;
 
void read_array ( int subtask_id , const std :: vector<int> &v ) {
    vector<int> q;
    string bits = "";
    for(int x : v){
        while(!q.empty() && q.back() < x) {
            q.pop_back();
            bits += '0';
        }
        q.push_back(x);
        bits += '1';
    }
    save_to_floppy(bits);
}
 
std::vector<int> solve_queries ( int subtask_id , int N, const std::string &bits, const std::vector<int> &a, const std::vector<int> &b) {
    int m = (int)a.size();
    vector<vector<int>> queries(N);
    for(int i = 0; i < m; i++){
        queries[b[i]].push_back(i);
    }
    int idx = -1;
    vector<int> q, res(m);
    for(char b : bits){
        if(b == '1'){
            q.push_back(++idx);
            for(int i : queries[idx]){
                res[i] = *lower_bound(q.begin(), q.end(), a[i]);
            }
        } else {
            q.pop_back();
        }
    }
    return res;
}

Compilation message

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) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 828 KB Output is correct
2 Correct 1 ms 828 KB Output is correct
3 Correct 1 ms 820 KB Output is correct
4 Correct 1 ms 828 KB Output is correct
5 Correct 1 ms 816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 3792 KB Output is correct
2 Correct 17 ms 3632 KB Output is correct
3 Correct 16 ms 3756 KB Output is correct
4 Correct 16 ms 3768 KB Output is correct
5 Correct 19 ms 3772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 13368 KB Output is correct
2 Correct 71 ms 13384 KB Output is correct
3 Correct 66 ms 13684 KB Output is correct
4 Correct 66 ms 13492 KB Output is correct
5 Correct 67 ms 13376 KB Output is correct