# 洛谷P3674 小清新人渣的本愿

n，m，V <= 100000

  1 #include <cstdio>
2 #include <bitset>
3 #include <cmath>
4 #include <algorithm>
5
6 const int N = 100010;
7
8 int fr[N], a[N], bin[N];
9 std::bitset<N> bs, bs2, tp;
10
12     int f, l, r, x, t, ans;
13     inline bool operator <(const ASK &w) const {
14         if(fr[l] != fr[w.l]) {
15             return l < w.l;
16         }
17         return r < w.r;
18     }
20
22     return A.t < B.t;
23 }
24
25 inline void add(int x) {
26     if(!bin[a[x]]) {
27         bs.set(a[x]);
28         bs2.set(N - a[x]);
29     }
30     bin[a[x]]++;
31     return;
32 }
33
34 inline void del(int x) {
35     bin[a[x]]--;
36     if(!bin[a[x]]) {
37         bs.reset(a[x]);
38         bs2.reset(N - a[x]);
39     }
40     return;
41 }
42
43 int main() {
44     int n, m;
45     scanf("%d%d", &n, &m);
46     int T = sqrt(n);
47     for(int i = 1; i <= n; i++) {
48         scanf("%d", &a[i]);
49         fr[i] = (i - 1) / T + 1;
50     }
51     for(int i = 1; i <= m; i++) {
54     }
56
57     int l = 1, r = 1;
58     bin[a[1]]++;
59     bs.set(a[1]);
60     bs2.set(N - a[1]);
61     for(int i = 1; i <= m; i++) {
64         }
67         }
69             del(l++);
70         }
72             del(r--);
73         }
74         // ------------
76             tp = bs & (bs >> ask[i].x);
78         }
79         else if(ask[i].f == 2) {
80             tp = bs & (bs2 >> (N - ask[i].x));
82         }
83         else {
84             bool fd = 0;
85             for(int j = 1; j * j <= ask[i].x; j++) {
87                     continue;
88                 }
89                 if(bs[j] && bs[ask[i].x / j]) {
91                     break;
92                 }
93             }
94         }
95     }
96
98     for(int i = 1; i <= m; i++) {
107 }