Submission #652310

#TimeUsernameProblemLanguageResultExecution timeMemory
652310Genius3435Kotrljanje (COCI18_kotrljanje)C++17
140 / 140
422 ms16748 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int constexpr DS = 32768; vector<ll> vals[DS]; int B; int ds(ll n) { int s = 0; while (n) s += n%B, n /= B; return s; } int main() { int C, D, M; cin >> C >> D >> B >> M; int mx_cnt = 0, mxi = -1; for (ll n = 1; mx_cnt < M; n += B-1) { int s = ds(C*n+D); vals[s].push_back(n); if (vals[s].size() > mx_cnt) { mx_cnt = vals[s].size(); mxi = s; } } for (ll const n : vals[mxi]) { cout << n << ' '; } cout << '\n'; }

Compilation message (stderr)

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:23:28: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |         if (vals[s].size() > mx_cnt) {
      |             ~~~~~~~~~~~~~~~^~~~~~~~
#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...
#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...