제출 #1139277

#제출 시각아이디문제언어결과실행 시간메모리
1139277AgageldiBinary Subsequences (info1cup17_binary)C++17
0 / 100
472 ms20520 KiB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define N 600005
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define sz(s) (int)s.size()

ll T, n, a[N], t, ans,b[25];
string s;
map <string,int> vis;

int main () {
	cin >> T;
	for(int op = 1; op <= T; op++){
		cin >> n;
		bool tr = 0;
		for(int i = 1; i <= 45; i++) {
			for(int j = 1; j <= 45; j++) {
				if(i*j + i + j == n && i + j <= n) {
					cout << "-1\n";
					for(int k = 1; k <= i; k++) {
						cout << '0' << " ";
					}
					for(int k = 1; k <= j; k++) {
						cout << '1' << " ";
					}
					cout << '\n';
					tr = 1;
					break;
				}
			}
			if(tr) break;
		}
		if(!tr) {
			cout << "-1\n";
			for(int i=1;i<=n;i++) {
				cout << '1' << " ";
			}
			cout << '\n';
		}
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...