제출 #1139281

#제출 시각아이디문제언어결과실행 시간메모리
1139281AgageldiBinary Subsequences (info1cup17_binary)C++17
0 / 100
795 ms976 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;
		int mn = INT_MAX, r = 0, l = 0;
		for(int i = 1; i <= 1000; i++) {
			for(int j = 0; j <= 1000; j++) {
				if(i*j + i + j == n && i + j <= n) {
					if(mn > i + j) {
						mn = i + j;
						l = i;
						r = j;
					}
				}
			}
		}
		cout << "-1\n";
		for(int i =1;i<=l;i++) {
			cout << '1' << " ";
		}
		for(int i=1;i<=r;i++) {
			cout << '0' << " ";
		}
		cout << '\n';
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...