Submission #1110769

# Submission time Handle Problem Language Result Execution time Memory
1110769 2024-11-10T12:05:35 Z Flandre Intercastellar (JOI22_ho_t1) C++17
100 / 100
130 ms 18760 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;

// loal is the cutest girl

#define ll long long
#define int ll
#define ld long double
#define pow2(x) (x)*(x)
#define le left
#define ri right
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(), v.end()
#define pii pair<int, int>
#define pll pair<long long, long long>
#define isvowel(x) (x) == 'a' || (x) == 'i' || (x) == 'u' || (x) == 'e' || (x) == 'o'
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

const ld EPS = 1e-9;
const ld PI = 3.141592653589793238462643383279502884197169399375105820974944;

signed main() {
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  
  int n;
  cin >> n;
  int pc = 0;
  set<pii> a;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    int smbit = __lg(x & -x);
    a.insert({pc+1, x >> smbit});
    pc += 1ll << smbit;
  }

  int q;
  cin >> q;
  while (q--) {
    int x;
    cin >> x;
    cout << prev(a.upper_bound({x, 1e18}))->se << '\n';
  }
  
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 52 ms 13132 KB Output is correct
4 Correct 35 ms 4680 KB Output is correct
5 Correct 85 ms 14920 KB Output is correct
6 Correct 59 ms 11848 KB Output is correct
7 Correct 94 ms 14924 KB Output is correct
8 Correct 93 ms 15176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 52 ms 13132 KB Output is correct
4 Correct 35 ms 4680 KB Output is correct
5 Correct 85 ms 14920 KB Output is correct
6 Correct 59 ms 11848 KB Output is correct
7 Correct 94 ms 14924 KB Output is correct
8 Correct 93 ms 15176 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 30 ms 4680 KB Output is correct
24 Correct 61 ms 12036 KB Output is correct
25 Correct 117 ms 18244 KB Output is correct
26 Correct 79 ms 11592 KB Output is correct
27 Correct 64 ms 12212 KB Output is correct
28 Correct 130 ms 18760 KB Output is correct
29 Correct 130 ms 18248 KB Output is correct
30 Correct 35 ms 4944 KB Output is correct
31 Correct 114 ms 18476 KB Output is correct