Submission #258196

#TimeUsernameProblemLanguageResultExecution timeMemory
258196oolimryDevil's Share (RMI19_devil)C++14
0 / 100
76 ms2084 KiB
#include <bits/stdc++.h> #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() using namespace std; typedef pair<int,int> ii; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int TC; cin >> TC; while(TC--){ int K; cin >> K; int cnt[10]; int S = 0; for(int i = 1;i <= 9;i++){ cin >> cnt[i]; S += cnt[i]; } if(K == 2){ int last = 0; int big = 9; while(cnt[big] == 0) big--; last = big; cnt[big]--; while(cnt[big] == 0) big--; S--; int l = 1, r = big; bool left = false; while(S--){ if(left){ while(cnt[l] == 0) l++; cout << l; cnt[l]--; } else{ while(cnt[r] == 0) r--; cout << r; cnt[r]--; } left = !left; } cout << last; cout << '\n'; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...