Submission #144143

#TimeUsernameProblemLanguageResultExecution timeMemory
144143SwanLottery (CEOI18_lot)C++14
25 / 100
73 ms504 KiB
#include <bits/stdc++.h> #define stop system("pause") #define INP freopen("input.txt","r",stdin) #define OUTP freopen("solve1.txt","w",stdout) using namespace std; vector<int> seq[400]; vector<int> v; int n,l; int val(vector<int>& a,vector<int>& b,int k){ int res = 0; for(int i(0); i < a.size();i++){ if(a[i]!=b[i])res++; } return res<=k; } void brute(){ for(int i(0); i < n;i++){ int r = i+l-1; if(r >= n)break; for(int j(i);j<=r;j++){ seq[i].push_back(v[j]); } } int q; cin >> q; for(int i(0); i < q;i++){ int k; cin >> k; for(int j(0); j < n-l+1;j++){ int ans = 0; for(int z(0); z < n-l+1;z++){ if(j == z)continue; ans+=val(seq[j],seq[z],k); } cout << ans << ' '; } cout << '\n'; } } main() { ios_base::sync_with_stdio(0); cin >> n >> l; for(int i(0); i < n;i++){ int x; cin >> x; v.push_back(x); } if(n<=300)brute(); return 0; } /* */

Compilation message (stderr)

lot.cpp: In function 'int val(std::vector<int>&, std::vector<int>&, int)':
lot.cpp:13:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i(0); i < a.size();i++){
                   ~~^~~~~~~~~~
lot.cpp: At global scope:
lot.cpp:42:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
#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...