Submission #332260

#TimeUsernameProblemLanguageResultExecution timeMemory
332260IgorIDevil's Share (RMI19_devil)C++17
0 / 100
41 ms1516 KiB
#include <bits/stdc++.h> using namespace std; void solve() { int n = 10; int k = 0; cin >> k; vector<int> d(n); for (int i = 1; i < n; i++) cin >> d[i]; if (d[1] == 0) { cout << string(d[2], '2') << "\n"; return; } string s(k - 1, '0'); for (int i = k - 2; i >= 0; i--) { if (d[2]) d[2]--, s[i] = '2'; else d[1]--, s[i] = '1'; } int c1 = d[1], c2 = d[2]; vector<int> h(c1, c2 / c1); int add = c2 % c1; //cout << c2 << " " << c1 << endl; if (add > 0) { for (int st = h.size(); st >= 1; st--) { if (h.size() / st >= add) { for (int i = 0; i < h.size(); i += st) { if (add) add--, h[i]++; } //cout << add << endl; break; } } } for (auto e : h) { for (int i = 0; i < e; i++) cout << "2"; cout << "1"; } cout << s << "\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { solve(); } }

Compilation message (stderr)

devil.cpp: In function 'void solve()':
devil.cpp:34:31: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |             if (h.size() / st >= add)
      |                 ~~~~~~~~~~~~~~^~~~~~
devil.cpp:36:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |                 for (int i = 0; i < h.size(); i += st)
      |                                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...