Submission #123209

# Submission time Handle Problem Language Result Execution time Memory
123209 2019-06-30T11:41:49 Z semiauto Lottery (CEOI18_lot) C++14
35 / 100
818 ms 4604 KB
#include <bits/stdc++.h>
using namespace std;
int n,l,i,j,k,m,d;
int mas[100001],fix[100001],where[100001],pre[10001][102],ans[101][10001];
pair <int,int> q[101];
int main() {
    cin>>n>>l;
    for (i=1;i<=n;i++)
        cin>>mas[i];
    cin>>m;
    for (i=1;i<=m;i++) {
        cin>>d;
        q[i]={d,i};
    }
    sort(q+1,q+m+1);
    for (i=1;i<=m;i++)
        where[q[i].first]=i;
    for (i=10000;i>=0;i--)
        if (!where[i])
            where[i]=where[i+1];
    for (d=1;d<=(n-l);d++) {
        for (i=1;i<=n;i++) {
            fix[i]=fix[i-1];
            if (mas[i]==mas[i+d])
                fix[i]++;
        }
        for (i=1;(i+d)<=(n-l+1);i++) {
            pre[i][where[l-fix[i+l-1]+fix[i-1]]]++;
            pre[i+d][where[l-fix[i+l-1]+fix[i-1]]]++;
        }
    }
    for (i=1;i<=m;i++)
        for (j=1;j<=(n-l+1);j++) {
            ans[q[i].second][j]=pre[j][i];
            pre[j][i+1]+=pre[j][i];
        }
    for (i=1;i<=m;i++) {
        for (j=1;j<(n-l+1);j++)
            cout<<ans[i][j]<<" ";
        cout<<ans[i][n-l+1]<<endl;
    }


}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Incorrect 2 ms 504 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Incorrect 2 ms 504 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 818 ms 4512 KB Output is correct
2 Correct 806 ms 4504 KB Output is correct
3 Correct 627 ms 4604 KB Output is correct
4 Correct 609 ms 4524 KB Output is correct
5 Correct 235 ms 2552 KB Output is correct
6 Correct 552 ms 4344 KB Output is correct
7 Correct 248 ms 2636 KB Output is correct
8 Correct 391 ms 3448 KB Output is correct
9 Correct 597 ms 4472 KB Output is correct
10 Correct 610 ms 4504 KB Output is correct
11 Correct 34 ms 1272 KB Output is correct
12 Correct 353 ms 3448 KB Output is correct
13 Correct 283 ms 3064 KB Output is correct
14 Correct 290 ms 2936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 818 ms 4512 KB Output is correct
2 Correct 806 ms 4504 KB Output is correct
3 Correct 627 ms 4604 KB Output is correct
4 Correct 609 ms 4524 KB Output is correct
5 Correct 235 ms 2552 KB Output is correct
6 Correct 552 ms 4344 KB Output is correct
7 Correct 248 ms 2636 KB Output is correct
8 Correct 391 ms 3448 KB Output is correct
9 Correct 597 ms 4472 KB Output is correct
10 Correct 610 ms 4504 KB Output is correct
11 Correct 34 ms 1272 KB Output is correct
12 Correct 353 ms 3448 KB Output is correct
13 Correct 283 ms 3064 KB Output is correct
14 Correct 290 ms 2936 KB Output is correct
15 Correct 603 ms 4448 KB Output is correct
16 Correct 542 ms 4216 KB Output is correct
17 Correct 626 ms 4600 KB Output is correct
18 Correct 610 ms 4604 KB Output is correct
19 Correct 608 ms 4600 KB Output is correct
20 Correct 606 ms 4600 KB Output is correct
21 Correct 609 ms 4548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Incorrect 2 ms 504 KB Output isn't correct
7 Halted 0 ms 0 KB -