Submission #118373

# Submission time Handle Problem Language Result Execution time Memory
118373 2019-06-18T20:10:34 Z davitmarg Lottery (CEOI18_lot) C++17
25 / 100
3000 ms 532 KB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <bitset>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
using namespace std;

int n,l,a[10004],Q,k;
int main()
{
    cin>>n>>l;
    for(int i=1;i<=n;i++)
        scanf("%d",a+i);
    cin>>Q;
    while(Q--)
    {
        scanf("%d",&k);
        vector<int> ans(n-l+3);
        for(int i=1;i<=n-l+1;i++)
            for(int j=i+1;j<=n-l+1;j++)
            {
                int cnt=0;
                for(int p=0;p<l;p++)
                    cnt+=(a[i+p]!=a[j+p]);
                ans[i]+=(cnt<=k);
                ans[j]+=(cnt<=k);
            }
        for(int i=1;i<=n-l+1;i++)
            printf("%d ",ans[i]);
        printf("\n");
    }

	return 0;
}


/*


*/

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",a+i);
         ~~~~~^~~~~~~~~~
lot.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&k);
         ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 484 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 30 ms 256 KB Output is correct
9 Correct 31 ms 384 KB Output is correct
10 Correct 14 ms 384 KB Output is correct
11 Correct 13 ms 384 KB Output is correct
12 Correct 21 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 484 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 30 ms 256 KB Output is correct
9 Correct 31 ms 384 KB Output is correct
10 Correct 14 ms 384 KB Output is correct
11 Correct 13 ms 384 KB Output is correct
12 Correct 21 ms 384 KB Output is correct
13 Correct 43 ms 384 KB Output is correct
14 Execution timed out 3022 ms 532 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 170 ms 504 KB Output is correct
2 Correct 281 ms 504 KB Output is correct
3 Correct 169 ms 512 KB Output is correct
4 Execution timed out 3043 ms 512 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 170 ms 504 KB Output is correct
2 Correct 281 ms 504 KB Output is correct
3 Correct 169 ms 512 KB Output is correct
4 Execution timed out 3043 ms 512 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 484 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 30 ms 256 KB Output is correct
9 Correct 31 ms 384 KB Output is correct
10 Correct 14 ms 384 KB Output is correct
11 Correct 13 ms 384 KB Output is correct
12 Correct 21 ms 384 KB Output is correct
13 Correct 43 ms 384 KB Output is correct
14 Execution timed out 3022 ms 532 KB Time limit exceeded
15 Halted 0 ms 0 KB -