제출 #1338203

#제출 시각아이디문제언어결과실행 시간메모리
1338203po_rag526Floppy (RMI20_floppy)C++17
100 / 100
61 ms8592 KiB
#include<bits/stdc++.h>
#include "floppy.h"
using namespace std;
typedef int ll;
const int mn = 2e5 + 5;


//void save_to_floppy(const string &b)

void read_array (ll Si, const vector<ll> &v ){
	stack<ll> s;
	string skibidi = "";
	for(int i = 0; i < v.size(); ++i){
		while(!s.empty() && v[s.top()] <= v[i]) s.pop(), skibidi += '0';
		s.push(i), skibidi += '1';
	}
	save_to_floppy(skibidi);
}

vector<ll> hehe[mn];

vector<ll> solve_queries(ll Si, ll n, const string &t, const vector<ll> &a, const vector<ll> &b){
	ll p = 0;
	vector<ll> ans;
	ans.assign(b.size(), 0);
	for(int i = 0; i < b.size(); ++i){
		hehe[b[i]].push_back(i);
	}
	vector<ll> s;
	for(int i = 0; i < n; ++i){
		while(t[p] == '0') s.pop_back(), ++p;
		s.push_back(i); ++p;
		for(auto j : hehe[i]){
			ans[j] = s[lower_bound(s.begin(), s.end(), a[j]) - s.begin()];
		}
	}
	return ans;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...