Submission #1060167

# Submission time Handle Problem Language Result Execution time Memory
1060167 2024-08-15T11:14:06 Z user736482 Lottery (CEOI18_lot) C++17
80 / 100
3000 ms 4188 KB
#include<bits/stdc++.h>
using namespace std;
int n,q,a,k,l;
vector<int>v,poz,pom;//duze jedno do usuniecia
int pod[10007];
int licz[107][10007];
int main(){
    cin>>n>>l;
    for(int i=0;i<n;i++){
        cin>>a;
        v.push_back(a);
    }


    cin>>q;
    for(int i=0;i<q;i++){

        cin>>k;
        k=l-k;

        pom.push_back(k);
    }
    for(int i=0;i<l-1;i++){
            poz.clear();
            for(int j=i+1;j<n;j++){
                if(v[i]==v[j]) poz.push_back(j);
            }
            for(int j=0;j<poz.size();j++){
                pod[-i+poz[j]]++;
            }
        }
        for(int i=l-1;i<n;i++){
            if(i!=l-1){
            poz.clear();
            i=i-l;
            for(int j=i+1;j<n;j++){
                if(v[i]==v[j]) poz.push_back(j);
            }
            for(int j=0;j<poz.size();j++){
                pod[-i+poz[j]]--;
            }
            i=i+l;}
                poz.clear();
            for(int j=i+1;j<n;j++){
                if(v[i]==v[j]) poz.push_back(j);
            }
            for(int j=0;j<poz.size();j++){
                pod[-i+poz[j]]++;
            }
            //for(int j=l-1;j<i;j++) cout<<0<<" ";
            //for(int j=i;j<n;j++)
                //cout<<pod[-i+j]<<" ";
            for(int j=i+1;j<n;j++){
                for(int s=0;s<q;s++){
                    k=pom[s];
                    if(pod[-i+j]>=k){
                        licz[s][i-l+1]++;
                        licz[s][j-l+1]++;
                    }
                }
                //match[i-l+1].push_back(pod[-i+j]);
                //match[j-l+1].push_back(pod[-i+j]);
            }
        }
    for(int i=0;i<q;i++){
        for(int j=0;j<n-l+1;j++){
            cout<<licz[i][j]<<" ";
        }
        cout<<"\n";
    }
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:28:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             for(int j=0;j<poz.size();j++){
      |                         ~^~~~~~~~~~~
lot.cpp:39:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             for(int j=0;j<poz.size();j++){
      |                         ~^~~~~~~~~~~
lot.cpp:47:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |             for(int j=0;j<poz.size();j++){
      |                         ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 19 ms 524 KB Output is correct
14 Correct 18 ms 2516 KB Output is correct
15 Correct 12 ms 2396 KB Output is correct
16 Correct 29 ms 2564 KB Output is correct
17 Correct 27 ms 2548 KB Output is correct
18 Correct 34 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 353 ms 604 KB Output is correct
2 Correct 305 ms 604 KB Output is correct
3 Correct 209 ms 604 KB Output is correct
4 Correct 127 ms 604 KB Output is correct
5 Correct 124 ms 604 KB Output is correct
6 Correct 126 ms 572 KB Output is correct
7 Correct 170 ms 600 KB Output is correct
8 Correct 201 ms 600 KB Output is correct
9 Correct 129 ms 576 KB Output is correct
10 Correct 144 ms 580 KB Output is correct
11 Correct 13 ms 344 KB Output is correct
12 Correct 97 ms 552 KB Output is correct
13 Correct 100 ms 568 KB Output is correct
14 Correct 113 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 353 ms 604 KB Output is correct
2 Correct 305 ms 604 KB Output is correct
3 Correct 209 ms 604 KB Output is correct
4 Correct 127 ms 604 KB Output is correct
5 Correct 124 ms 604 KB Output is correct
6 Correct 126 ms 572 KB Output is correct
7 Correct 170 ms 600 KB Output is correct
8 Correct 201 ms 600 KB Output is correct
9 Correct 129 ms 576 KB Output is correct
10 Correct 144 ms 580 KB Output is correct
11 Correct 13 ms 344 KB Output is correct
12 Correct 97 ms 552 KB Output is correct
13 Correct 100 ms 568 KB Output is correct
14 Correct 113 ms 348 KB Output is correct
15 Correct 305 ms 604 KB Output is correct
16 Correct 124 ms 604 KB Output is correct
17 Correct 149 ms 604 KB Output is correct
18 Correct 126 ms 592 KB Output is correct
19 Correct 122 ms 564 KB Output is correct
20 Correct 127 ms 592 KB Output is correct
21 Correct 128 ms 564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 19 ms 524 KB Output is correct
14 Correct 18 ms 2516 KB Output is correct
15 Correct 12 ms 2396 KB Output is correct
16 Correct 29 ms 2564 KB Output is correct
17 Correct 27 ms 2548 KB Output is correct
18 Correct 34 ms 2396 KB Output is correct
19 Correct 353 ms 604 KB Output is correct
20 Correct 305 ms 604 KB Output is correct
21 Correct 209 ms 604 KB Output is correct
22 Correct 127 ms 604 KB Output is correct
23 Correct 124 ms 604 KB Output is correct
24 Correct 126 ms 572 KB Output is correct
25 Correct 170 ms 600 KB Output is correct
26 Correct 201 ms 600 KB Output is correct
27 Correct 129 ms 576 KB Output is correct
28 Correct 144 ms 580 KB Output is correct
29 Correct 13 ms 344 KB Output is correct
30 Correct 97 ms 552 KB Output is correct
31 Correct 100 ms 568 KB Output is correct
32 Correct 113 ms 348 KB Output is correct
33 Correct 305 ms 604 KB Output is correct
34 Correct 124 ms 604 KB Output is correct
35 Correct 149 ms 604 KB Output is correct
36 Correct 126 ms 592 KB Output is correct
37 Correct 122 ms 564 KB Output is correct
38 Correct 127 ms 592 KB Output is correct
39 Correct 128 ms 564 KB Output is correct
40 Correct 1298 ms 3408 KB Output is correct
41 Correct 67 ms 2644 KB Output is correct
42 Correct 860 ms 3520 KB Output is correct
43 Correct 756 ms 3152 KB Output is correct
44 Correct 759 ms 3248 KB Output is correct
45 Execution timed out 3063 ms 4188 KB Time limit exceeded
46 Halted 0 ms 0 KB -