Submission #960429

# Submission time Handle Problem Language Result Execution time Memory
960429 2024-04-10T12:51:01 Z vjudge1 Lottery (CEOI18_lot) C++14
100 / 100
327 ms 8656 KB
#include<bits/stdc++.h>

using namespace std;

const int N=1e4+10, Q=110;
int n, l, q, a[N];
int cnt[N][Q];
int qq[Q];
int mp[N];

int32_t main(){
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   cin >> n >> l;
   for (int i=1; i<=n; ++i) cin >> a[i];
   cin >> q;
   vector<int> vals{-1};
   for (int i=1; i<=q; ++i) cin >> qq[i], vals.push_back(qq[i]);
   sort(vals.begin(), vals.end());
   for (int i=0, j=1; i<=n; ++i){
      while (j<=q && i>vals[j]) ++j;
      mp[i]=j;
   }
   for (int d=1; d<=n; ++d){
      int cur=0;
      for (int l1=1, r1=l, l2=l1+d, r2=r1+d; r2<=n; ++l1, ++r1, ++l2, ++r2){
         if (l1==1){
            for (int j=1; j<=l; ++j) cur+=a[l1+j-1]!=a[l2+j-1];
         }else{
            cur-=a[l1-1]!=a[l2-1];
            cur+=a[r1]!=a[r2];
         }
         if (mp[cur]!=q+1) ++cnt[l1][mp[cur]], ++cnt[l2][mp[cur]];
      }
   }
   for (int i=1; i<=n; ++i){
      partial_sum(cnt[i], cnt[i]+q+1, cnt[i]);
   }
   for (int i=1; i<=q; ++i){
      for (int j=1; j+l-1<=n; ++j) cout << cnt[j][mp[qq[i]]] << " \n"[j+l-1==n];
   }
   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 11 ms 2648 KB Output is correct
14 Correct 6 ms 2652 KB Output is correct
15 Correct 4 ms 2652 KB Output is correct
16 Correct 7 ms 2652 KB Output is correct
17 Correct 6 ms 2652 KB Output is correct
18 Correct 6 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 187 ms 4848 KB Output is correct
2 Correct 113 ms 4700 KB Output is correct
3 Correct 97 ms 4844 KB Output is correct
4 Correct 95 ms 4836 KB Output is correct
5 Correct 42 ms 4736 KB Output is correct
6 Correct 87 ms 4728 KB Output is correct
7 Correct 66 ms 4856 KB Output is correct
8 Correct 112 ms 4948 KB Output is correct
9 Correct 104 ms 4856 KB Output is correct
10 Correct 100 ms 4860 KB Output is correct
11 Correct 6 ms 2652 KB Output is correct
12 Correct 61 ms 4708 KB Output is correct
13 Correct 54 ms 4712 KB Output is correct
14 Correct 53 ms 4724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 187 ms 4848 KB Output is correct
2 Correct 113 ms 4700 KB Output is correct
3 Correct 97 ms 4844 KB Output is correct
4 Correct 95 ms 4836 KB Output is correct
5 Correct 42 ms 4736 KB Output is correct
6 Correct 87 ms 4728 KB Output is correct
7 Correct 66 ms 4856 KB Output is correct
8 Correct 112 ms 4948 KB Output is correct
9 Correct 104 ms 4856 KB Output is correct
10 Correct 100 ms 4860 KB Output is correct
11 Correct 6 ms 2652 KB Output is correct
12 Correct 61 ms 4708 KB Output is correct
13 Correct 54 ms 4712 KB Output is correct
14 Correct 53 ms 4724 KB Output is correct
15 Correct 166 ms 4780 KB Output is correct
16 Correct 86 ms 4856 KB Output is correct
17 Correct 110 ms 4892 KB Output is correct
18 Correct 97 ms 4736 KB Output is correct
19 Correct 102 ms 4748 KB Output is correct
20 Correct 110 ms 4880 KB Output is correct
21 Correct 107 ms 4880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 11 ms 2648 KB Output is correct
14 Correct 6 ms 2652 KB Output is correct
15 Correct 4 ms 2652 KB Output is correct
16 Correct 7 ms 2652 KB Output is correct
17 Correct 6 ms 2652 KB Output is correct
18 Correct 6 ms 2652 KB Output is correct
19 Correct 187 ms 4848 KB Output is correct
20 Correct 113 ms 4700 KB Output is correct
21 Correct 97 ms 4844 KB Output is correct
22 Correct 95 ms 4836 KB Output is correct
23 Correct 42 ms 4736 KB Output is correct
24 Correct 87 ms 4728 KB Output is correct
25 Correct 66 ms 4856 KB Output is correct
26 Correct 112 ms 4948 KB Output is correct
27 Correct 104 ms 4856 KB Output is correct
28 Correct 100 ms 4860 KB Output is correct
29 Correct 6 ms 2652 KB Output is correct
30 Correct 61 ms 4708 KB Output is correct
31 Correct 54 ms 4712 KB Output is correct
32 Correct 53 ms 4724 KB Output is correct
33 Correct 166 ms 4780 KB Output is correct
34 Correct 86 ms 4856 KB Output is correct
35 Correct 110 ms 4892 KB Output is correct
36 Correct 97 ms 4736 KB Output is correct
37 Correct 102 ms 4748 KB Output is correct
38 Correct 110 ms 4880 KB Output is correct
39 Correct 107 ms 4880 KB Output is correct
40 Correct 220 ms 5588 KB Output is correct
41 Correct 10 ms 4952 KB Output is correct
42 Correct 120 ms 5592 KB Output is correct
43 Correct 101 ms 5200 KB Output is correct
44 Correct 104 ms 5372 KB Output is correct
45 Correct 327 ms 8636 KB Output is correct
46 Correct 16 ms 5208 KB Output is correct
47 Correct 270 ms 8656 KB Output is correct
48 Correct 152 ms 6916 KB Output is correct
49 Correct 136 ms 7676 KB Output is correct