Submission #484226

#TimeUsernameProblemLanguageResultExecution timeMemory
484226nickmet2004Lottery (CEOI18_lot)C++11
45 / 100
486 ms65540 KiB
#include<bits/stdc++.h> using namespace std; const int N = 1e4 + 5; int n , l , a[N]; vector<int> B[N]; int main (){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> l; for(int i = 1; i <= n; ++i) cin >> a[i]; for(int i = 1; i <= n - l+1; ++i){ for(int j = i + 1; j <= n - l+1; ++j){ int cnt = 0; for(int k = 0; k < l; ++k){ if(a[i + k] != a[j + k]) cnt++; } B[i].emplace_back(cnt); B[j].emplace_back(cnt); } } for(int i = 1; i <= n - l+1; ++i) sort(B[i].begin() , B[i].end()); /* for(int i = 1; i <= n -l+1; ++i){ for(int x : B[i])cout << x << " ";cout << endl; } */ int q; cin >> q; while(q--){ int Kj; cin >> Kj; for(int i = 1;i <= n - l + 1; ++i) cout << upper_bound(B[i].begin() ,B[i].end() , Kj) - B[i].begin() << " ";cout << endl; } return 0; }

Compilation message (stderr)

lot.cpp: In function 'int main()':
lot.cpp:32:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   32 |         for(int i = 1;i <= n - l + 1; ++i) cout << upper_bound(B[i].begin() ,B[i].end() , Kj) - B[i].begin() << " ";cout << endl;
      |         ^~~
lot.cpp:32:117: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   32 |         for(int i = 1;i <= n - l + 1; ++i) cout << upper_bound(B[i].begin() ,B[i].end() , Kj) - B[i].begin() << " ";cout << endl;
      |                                                                                                                     ^~~~
#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...