Submission #940068

# Submission time Handle Problem Language Result Execution time Memory
940068 2024-03-07T05:01:00 Z vjudge1 Lottery (CEOI18_lot) C++17
45 / 100
255 ms 64608 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
const int N=2005;
int ans[N][N];

signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.tie(0);
    int n,l;
    cin>>n>>l;
    vector <int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    
    vector <vector <int> > vec;
    for(int i=0;i<n-l+1;i++){
        vector <int> v;
        for(int j=i;j<l+i;j++){
            v.pb(a[j]);
        }
        vec.pb(v);
    }
    for(int i=0;i<vec.size();i++){
        for(int j=i+1;j<vec.size();j++){
            int cnt=0;
            for(int k=0;k<l;k++){
                if(vec[i][k]!=vec[j][k])cnt++;
            }
            ans[i][cnt]++;
            ans[j][cnt]++;
        }
    }
    for(int i=0;i<vec.size();i++){
        for(int j=1;j<=l;j++)ans[i][j]+=ans[i][j-1];
    }
    int q;
    cin>>q;
    while(q--){
        int k;cin>>k;
        for(int i=0;i<vec.size();i++){
            cout<<ans[i][k]<<" ";
        }
        cout<<"\n";
    }
}
/*
6 2
1 2 1 3 2 1
2
1
2
*/
           
 
           

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:27:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int i=0;i<vec.size();i++){
      |                 ~^~~~~~~~~~~
lot.cpp:28:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for(int j=i+1;j<vec.size();j++){
      |                       ~^~~~~~~~~~~
lot.cpp:37:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int i=0;i<vec.size();i++){
      |                 ~^~~~~~~~~~~
lot.cpp:44:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         for(int i=0;i<vec.size();i++){
      |                     ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 2 ms 4804 KB Output is correct
9 Correct 2 ms 4700 KB Output is correct
10 Correct 2 ms 6488 KB Output is correct
11 Correct 2 ms 6492 KB Output is correct
12 Correct 2 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 2 ms 4804 KB Output is correct
9 Correct 2 ms 4700 KB Output is correct
10 Correct 2 ms 6488 KB Output is correct
11 Correct 2 ms 6492 KB Output is correct
12 Correct 2 ms 4444 KB Output is correct
13 Correct 22 ms 31320 KB Output is correct
14 Correct 243 ms 30120 KB Output is correct
15 Correct 255 ms 30296 KB Output is correct
16 Correct 193 ms 32412 KB Output is correct
17 Correct 189 ms 31580 KB Output is correct
18 Correct 207 ms 31620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 64608 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 64608 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 2 ms 4804 KB Output is correct
9 Correct 2 ms 4700 KB Output is correct
10 Correct 2 ms 6488 KB Output is correct
11 Correct 2 ms 6492 KB Output is correct
12 Correct 2 ms 4444 KB Output is correct
13 Correct 22 ms 31320 KB Output is correct
14 Correct 243 ms 30120 KB Output is correct
15 Correct 255 ms 30296 KB Output is correct
16 Correct 193 ms 32412 KB Output is correct
17 Correct 189 ms 31580 KB Output is correct
18 Correct 207 ms 31620 KB Output is correct
19 Runtime error 34 ms 64608 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -