Submission #259956

#TimeUsernameProblemLanguageResultExecution timeMemory
259956peuchLottery (CEOI18_lot)C++17
0 / 100
539 ms65540 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 10010; int n, l, q; int v[MAXN]; int freq[MAXN]; map<vector<int>, int> code; int cnt; int main(){ scanf("%d %d", &n, &l); for(int i = 1; i <= n; i++) scanf("%d", &v[i]); int fim = 1; vector<int> aux; vector<int> values; while(fim < l){ aux.push_back(v[fim]); fim++; } while(fim <= n){ aux.push_back(v[fim]); fim++; if(code[aux] == 0) code[aux] = ++cnt; freq[code[aux]]++; values.push_back(code[aux]); for(int i = 0; i < l - 1; i++) swap(aux[i], aux[i + 1]); aux.pop_back(); } scanf("%d", &q); for(int i = 1; i <= q; i++){ int k; scanf("%d", &k); for(int i = 0; i < values.size(); i++) printf("%d ", freq[values[i]] - 1); printf("\n"); } }

Compilation message (stderr)

lot.cpp: In function 'int main()':
lot.cpp:39:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < values.size(); i++)
                  ~~^~~~~~~~~~~~~~~
lot.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &l);
  ~~~~~^~~~~~~~~~~~~~~~~
lot.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &v[i]);
   ~~~~~^~~~~~~~~~~~~
lot.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
lot.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &k);
   ~~~~~^~~~~~~~~~
#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...