Submission #1060194

# Submission time Handle Problem Language Result Execution time Memory
1060194 2024-08-15T11:26:07 Z user736482 Lottery (CEOI18_lot) C++17
80 / 100
3000 ms 4184 KB
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
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(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    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]++;
                    }
                }
            }
        }
    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:32:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             for(int j=0;j<poz.size();j++){
      |                         ~^~~~~~~~~~~
lot.cpp:43:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             for(int j=0;j<poz.size();j++){
      |                         ~^~~~~~~~~~~
lot.cpp:51:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |             for(int j=0;j<poz.size();j++){
      |                         ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 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 2 ms 2396 KB Output is correct
11 Correct 4 ms 2396 KB Output is correct
12 Correct 3 ms 2536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 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 2 ms 2396 KB Output is correct
11 Correct 4 ms 2396 KB Output is correct
12 Correct 3 ms 2536 KB Output is correct
13 Correct 20 ms 348 KB Output is correct
14 Correct 22 ms 2544 KB Output is correct
15 Correct 14 ms 2396 KB Output is correct
16 Correct 38 ms 2588 KB Output is correct
17 Correct 33 ms 2396 KB Output is correct
18 Correct 33 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 300 ms 848 KB Output is correct
2 Correct 236 ms 652 KB Output is correct
3 Correct 195 ms 624 KB Output is correct
4 Correct 126 ms 620 KB Output is correct
5 Correct 113 ms 600 KB Output is correct
6 Correct 111 ms 604 KB Output is correct
7 Correct 173 ms 664 KB Output is correct
8 Correct 195 ms 852 KB Output is correct
9 Correct 118 ms 608 KB Output is correct
10 Correct 120 ms 608 KB Output is correct
11 Correct 12 ms 344 KB Output is correct
12 Correct 93 ms 572 KB Output is correct
13 Correct 95 ms 600 KB Output is correct
14 Correct 101 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 300 ms 848 KB Output is correct
2 Correct 236 ms 652 KB Output is correct
3 Correct 195 ms 624 KB Output is correct
4 Correct 126 ms 620 KB Output is correct
5 Correct 113 ms 600 KB Output is correct
6 Correct 111 ms 604 KB Output is correct
7 Correct 173 ms 664 KB Output is correct
8 Correct 195 ms 852 KB Output is correct
9 Correct 118 ms 608 KB Output is correct
10 Correct 120 ms 608 KB Output is correct
11 Correct 12 ms 344 KB Output is correct
12 Correct 93 ms 572 KB Output is correct
13 Correct 95 ms 600 KB Output is correct
14 Correct 101 ms 600 KB Output is correct
15 Correct 303 ms 604 KB Output is correct
16 Correct 107 ms 624 KB Output is correct
17 Correct 142 ms 604 KB Output is correct
18 Correct 115 ms 600 KB Output is correct
19 Correct 127 ms 624 KB Output is correct
20 Correct 116 ms 588 KB Output is correct
21 Correct 137 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 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 2 ms 2396 KB Output is correct
11 Correct 4 ms 2396 KB Output is correct
12 Correct 3 ms 2536 KB Output is correct
13 Correct 20 ms 348 KB Output is correct
14 Correct 22 ms 2544 KB Output is correct
15 Correct 14 ms 2396 KB Output is correct
16 Correct 38 ms 2588 KB Output is correct
17 Correct 33 ms 2396 KB Output is correct
18 Correct 33 ms 2392 KB Output is correct
19 Correct 300 ms 848 KB Output is correct
20 Correct 236 ms 652 KB Output is correct
21 Correct 195 ms 624 KB Output is correct
22 Correct 126 ms 620 KB Output is correct
23 Correct 113 ms 600 KB Output is correct
24 Correct 111 ms 604 KB Output is correct
25 Correct 173 ms 664 KB Output is correct
26 Correct 195 ms 852 KB Output is correct
27 Correct 118 ms 608 KB Output is correct
28 Correct 120 ms 608 KB Output is correct
29 Correct 12 ms 344 KB Output is correct
30 Correct 93 ms 572 KB Output is correct
31 Correct 95 ms 600 KB Output is correct
32 Correct 101 ms 600 KB Output is correct
33 Correct 303 ms 604 KB Output is correct
34 Correct 107 ms 624 KB Output is correct
35 Correct 142 ms 604 KB Output is correct
36 Correct 115 ms 600 KB Output is correct
37 Correct 127 ms 624 KB Output is correct
38 Correct 116 ms 588 KB Output is correct
39 Correct 137 ms 848 KB Output is correct
40 Correct 1458 ms 3600 KB Output is correct
41 Correct 51 ms 2668 KB Output is correct
42 Correct 1113 ms 3408 KB Output is correct
43 Correct 1030 ms 3156 KB Output is correct
44 Correct 1062 ms 3172 KB Output is correct
45 Execution timed out 3024 ms 4184 KB Time limit exceeded
46 Halted 0 ms 0 KB -