#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;
}
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) {
| ~~~~~~~~~~~~~~~~~~~~~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
628 KB |
Output is correct |
2 |
Correct |
2 ms |
648 KB |
Output is correct |
3 |
Correct |
2 ms |
776 KB |
Output is correct |
4 |
Correct |
2 ms |
788 KB |
Output is correct |
5 |
Correct |
2 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
3476 KB |
Output is correct |
2 |
Correct |
22 ms |
3556 KB |
Output is correct |
3 |
Correct |
20 ms |
3600 KB |
Output is correct |
4 |
Correct |
20 ms |
3544 KB |
Output is correct |
5 |
Correct |
20 ms |
3552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
112 ms |
13280 KB |
Output is correct |
2 |
Correct |
81 ms |
13192 KB |
Output is correct |
3 |
Correct |
86 ms |
13308 KB |
Output is correct |
4 |
Correct |
95 ms |
13344 KB |
Output is correct |
5 |
Correct |
83 ms |
13208 KB |
Output is correct |