Submission #473995

#TimeUsernameProblemLanguageResultExecution timeMemory
473995ZaZo_Lottery (CEOI18_lot)C++14
45 / 100
3067 ms31780 KiB
#include <bits/stdc++.h> #define ZAZO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define int long long const int N = 2010; using namespace std; int n , l ,q; int v[N][N]; int ans[10005]={0},arr[10005]; int32_t main() { ZAZO cin >> n >> l ; string s=""; for(int i = 0 ; i < n ; i ++) { cin >> arr[i]; s+=arr[i]+'0'; } cin>>q; int flg=0; for(int i = 0 ; i < q ; i++){ int k; cin>>k; if(k==0 && q==1) { for(int i = 0 ; i < s.size()-l+1 ; i++) { string a = s.substr(i , l); for(int j = i+1 ; j < s.size()-l+1 ; j++) { string b = s.substr(j , l); if(a==b) ans[i]++,ans[j]++; } } for(int i = 0 ; i < n-l+1 ; i++) { cout<<ans[i]<<" "; } } else { if(!flg) { flg=1; for(int i = 0 ; i < n-l+1 ; i ++) { for(int j = i+1 ; j < n-l+1 ; j ++) { int cur=0; for(int p = 0 ; p < l ; p ++) if(arr[i+p] != arr[j+p] ) cur++; v[i][j]=v[j][i]=cur; } } } for(int i = 0 ; i < n-l+1 ; i ++) { ans[i]=-1; for(int j = 0 ; j < n-l+1 ; j++) { if(v[i][j]<=k) ans[i]++; } cout<<ans[i]<<" "; } cout<<'\n'; } } }

Compilation message (stderr)

lot.cpp: In function 'int32_t main()':
lot.cpp:25:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   25 |     for(int i = 0 ; i < s.size()-l+1 ; i++)
      |                     ~~^~~~~~~~~~~~~~
lot.cpp:28:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   28 |       for(int j = i+1 ; j < s.size()-l+1 ; j++)
      |                         ~~^~~~~~~~~~~~~~
#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...