# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
640838 | 2022-09-15T10:47:02 Z | Vladth11 | Floppy (RMI20_floppy) | C++14 | 96 ms | 19392 KB |
#include <bits/stdc++.h> #include "floppy.h" #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " using namespace std; typedef long long ll; typedef pair <ll, ll> pii; typedef pair <long double, pii> muchie; const ll NMAX = 200001; const ll VMAX = 101; const ll INF = 2e9; const ll MOD = 1000000007; const ll BLOCK = 447; const ll base = 117; const ll nr_of_bits = 17; const ll inv2 = 500000004; ll stiva[NMAX]; vector <pii> events[NMAX]; std::vector<int> solve_queries(int subtask_id, int N, const std::string &bits, const std::vector<int> &a, const std::vector<int> &b) { vector <int> answers(a.size()); for(ll i = 0; i < a.size(); i++){ events[b[i]].push_back({a[i], i}); } ll j = 0, vf = 0; for(ll i = 0; i < N; i++){ while(bits[j] == '0'){ vf--; j++; } stiva[++vf] = i; j++; for(auto x : events[i]){ ll r = vf, pas = (1 << nr_of_bits); while(pas){ if(r - pas >= 1 && stiva[r - pas] >= x.first){ r -= pas; } pas /= 2; } answers[x.second] = stiva[r]; } } return answers; } void read_array(int subtask_id, const std::vector<int> &v) { stack <ll> st; string s = ""; ll i = 0; for(auto x : v){ while(st.size() && v[st.top()] < x){ s += '0'; st.pop(); } st.push(i); i++; s += '1'; } save_to_floppy(s); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 10012 KB | Output is correct |
2 | Correct | 6 ms | 10020 KB | Output is correct |
3 | Correct | 6 ms | 10020 KB | Output is correct |
4 | Correct | 6 ms | 10012 KB | Output is correct |
5 | Correct | 6 ms | 10012 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 12324 KB | Output is correct |
2 | Correct | 31 ms | 12296 KB | Output is correct |
3 | Correct | 26 ms | 12296 KB | Output is correct |
4 | Correct | 27 ms | 12320 KB | Output is correct |
5 | Correct | 33 ms | 12240 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 95 ms | 19064 KB | Output is correct |
2 | Correct | 89 ms | 19152 KB | Output is correct |
3 | Correct | 96 ms | 19144 KB | Output is correct |
4 | Correct | 95 ms | 19392 KB | Output is correct |
5 | Correct | 92 ms | 19080 KB | Output is correct |