Submission #338020

#TimeUsernameProblemLanguageResultExecution timeMemory
338020NimbostratusDevil's Share (RMI19_devil)C++17
0 / 100
1588 ms620 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e15; int TC; int K,cnt[15]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //freopen("in","r",stdin); //freopen("out","w",stdout); cin >> TC; while(TC--) { string perm,str; ll mn = INF; cin >> K; for(int i=1;i<=9;i++) cin >> cnt[i]; for(int i=1;i<=9;i++) for(int j=1;j<=cnt[i];j++) perm += char('0' + i); do { ll cur = 0; for(int i=0;i+K-1<perm.size();i++) cur = max(cur,stoll(perm.substr(i,K))); if(mn > cur) { mn = cur; str = perm; } } while(next_permutation(perm.begin(),perm.end())); cout << str << endl; } }

Compilation message (stderr)

devil.cpp: In function 'int32_t main()':
devil.cpp:29:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |    for(int i=0;i+K-1<perm.size();i++)
      |                ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...