Submission #940068

#TimeUsernameProblemLanguageResultExecution timeMemory
940068vjudge1Lottery (CEOI18_lot)C++17
45 / 100
255 ms64608 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...