답안 #1060193

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1060193 2024-08-15T11:25:33 Z user736482 Lottery (CEOI18_lot) C++17
80 / 100
3000 ms 4188 KB
#include<bits/stdc++.h>
#pragma GCC optimize ("O3")
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++){
      |                         ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 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 2 ms 2396 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 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 2 ms 2396 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 20 ms 344 KB Output is correct
14 Correct 22 ms 2396 KB Output is correct
15 Correct 14 ms 2580 KB Output is correct
16 Correct 38 ms 2640 KB Output is correct
17 Correct 33 ms 2392 KB Output is correct
18 Correct 33 ms 2576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 296 ms 600 KB Output is correct
2 Correct 237 ms 604 KB Output is correct
3 Correct 196 ms 604 KB Output is correct
4 Correct 118 ms 624 KB Output is correct
5 Correct 112 ms 600 KB Output is correct
6 Correct 111 ms 616 KB Output is correct
7 Correct 185 ms 600 KB Output is correct
8 Correct 199 ms 680 KB Output is correct
9 Correct 118 ms 604 KB Output is correct
10 Correct 119 ms 600 KB Output is correct
11 Correct 12 ms 348 KB Output is correct
12 Correct 89 ms 568 KB Output is correct
13 Correct 90 ms 604 KB Output is correct
14 Correct 103 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 296 ms 600 KB Output is correct
2 Correct 237 ms 604 KB Output is correct
3 Correct 196 ms 604 KB Output is correct
4 Correct 118 ms 624 KB Output is correct
5 Correct 112 ms 600 KB Output is correct
6 Correct 111 ms 616 KB Output is correct
7 Correct 185 ms 600 KB Output is correct
8 Correct 199 ms 680 KB Output is correct
9 Correct 118 ms 604 KB Output is correct
10 Correct 119 ms 600 KB Output is correct
11 Correct 12 ms 348 KB Output is correct
12 Correct 89 ms 568 KB Output is correct
13 Correct 90 ms 604 KB Output is correct
14 Correct 103 ms 604 KB Output is correct
15 Correct 310 ms 628 KB Output is correct
16 Correct 116 ms 636 KB Output is correct
17 Correct 145 ms 616 KB Output is correct
18 Correct 115 ms 632 KB Output is correct
19 Correct 120 ms 604 KB Output is correct
20 Correct 160 ms 572 KB Output is correct
21 Correct 116 ms 580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 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 2 ms 2396 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 20 ms 344 KB Output is correct
14 Correct 22 ms 2396 KB Output is correct
15 Correct 14 ms 2580 KB Output is correct
16 Correct 38 ms 2640 KB Output is correct
17 Correct 33 ms 2392 KB Output is correct
18 Correct 33 ms 2576 KB Output is correct
19 Correct 296 ms 600 KB Output is correct
20 Correct 237 ms 604 KB Output is correct
21 Correct 196 ms 604 KB Output is correct
22 Correct 118 ms 624 KB Output is correct
23 Correct 112 ms 600 KB Output is correct
24 Correct 111 ms 616 KB Output is correct
25 Correct 185 ms 600 KB Output is correct
26 Correct 199 ms 680 KB Output is correct
27 Correct 118 ms 604 KB Output is correct
28 Correct 119 ms 600 KB Output is correct
29 Correct 12 ms 348 KB Output is correct
30 Correct 89 ms 568 KB Output is correct
31 Correct 90 ms 604 KB Output is correct
32 Correct 103 ms 604 KB Output is correct
33 Correct 310 ms 628 KB Output is correct
34 Correct 116 ms 636 KB Output is correct
35 Correct 145 ms 616 KB Output is correct
36 Correct 115 ms 632 KB Output is correct
37 Correct 120 ms 604 KB Output is correct
38 Correct 160 ms 572 KB Output is correct
39 Correct 116 ms 580 KB Output is correct
40 Correct 1427 ms 3588 KB Output is correct
41 Correct 52 ms 2652 KB Output is correct
42 Correct 1150 ms 3592 KB Output is correct
43 Correct 1020 ms 3044 KB Output is correct
44 Correct 1053 ms 3152 KB Output is correct
45 Execution timed out 3068 ms 4188 KB Time limit exceeded
46 Halted 0 ms 0 KB -