Submission #258196

# Submission time Handle Problem Language Result Execution time Memory
258196 2020-08-05T14:12:28 Z oolimry Devil's Share (RMI19_devil) C++14
0 / 100
76 ms 2084 KB
#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 time Memory Grader output
1 Incorrect 2 ms 384 KB Token parameter [name=X] equals to "41413132324", doesn't correspond to pattern "[0-9]{7}"
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 2084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 384 KB Token parameter [name=X] equals to "212121212111111111111111111111111111111112", doesn't correspond to pattern "[0-9]{26}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Token parameter [name=X] equals to "41413132324", doesn't correspond to pattern "[0-9]{7}"