Submission #201693

#TimeUsernameProblemLanguageResultExecution timeMemory
201693kostia244Devil's Share (RMI19_devil)C++17
0 / 100
47 ms1404 KiB
#pragma GCC optimize("O2") #pragma GCC target("avx,avx2,ssse3,sse2,sse,fma,tune=native") #pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> #include<bits/extc++.h> #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define pb push_back using namespace std; using ll = long long; using vi = vector<int>; using pi = pair<int, int>; using vpi = vector<pair<int, int>>; using namespace __gnu_pbds; using oset = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>; int k, a[11], perm[15]; string solve() { } string solve2() { int mx = 0, s = 0; for(int i = 1; i <= 9; i++) { if(a[i]) mx = i; s+=a[i]; } string ans; if(a[mx]<=s-a[mx]) { int u = mx-1; while(a[mx]) { while(!a[u]) u--; ans += u+'0'; ans += mx+'0'; a[u]--; a[mx]--; } while(u>0) { while(a[u]) ans += u+'0', a[u]--; u--; } return ans; } int u = 9; while(u>0) { while(a[u]) ans += u+'0', a[u]--; u--; } return ans; } void read() { cin >> k; for(int i = 1; i <= 9; i++) cin >> a[i]; if(k==2) cout << solve2() << "\n"; // else // cout << solve() << "\n"; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while(t--) read(); return 0; }

Compilation message (stderr)

devil.cpp: In function 'std::__cxx11::string solve()':
devil.cpp:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...