結果

問題 No.941 商とあまり
ユーザー hitonanodehitonanode
提出日時 2019-12-04 12:56:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,596 bytes
コンパイル時間 2,012 ms
コンパイル使用メモリ 171,336 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-07 13:39:13
合計ジャッジ時間 7,904 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 15 ms
6,944 KB
testcase_05 AC 24 ms
6,944 KB
testcase_06 AC 19 ms
6,944 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 19 ms
6,944 KB
testcase_13 AC 27 ms
6,940 KB
testcase_14 AC 23 ms
6,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 27 ms
6,944 KB
testcase_18 AC 26 ms
6,944 KB
testcase_19 AC 25 ms
6,944 KB
testcase_20 AC 20 ms
6,940 KB
testcase_21 AC 21 ms
6,944 KB
testcase_22 AC 24 ms
6,940 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
6,940 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 22 ms
6,940 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 22 ms
6,944 KB
testcase_32 WA -
testcase_33 AC 14 ms
6,944 KB
testcase_34 AC 26 ms
6,940 KB
testcase_35 AC 26 ms
6,940 KB
testcase_36 AC 18 ms
6,944 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 19 ms
6,940 KB
testcase_40 AC 15 ms
6,944 KB
testcase_41 AC 15 ms
6,940 KB
testcase_42 AC 15 ms
6,944 KB
testcase_43 AC 19 ms
6,940 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 22 ms
6,944 KB
testcase_48 AC 19 ms
6,944 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 19 ms
6,940 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 AC 22 ms
6,940 KB
testcase_58 AC 22 ms
6,940 KB
testcase_59 AC 19 ms
6,944 KB
testcase_60 AC 19 ms
6,944 KB
testcase_61 AC 18 ms
6,944 KB
testcase_62 AC 19 ms
6,940 KB
testcase_63 AC 18 ms
6,940 KB
testcase_64 AC 19 ms
6,944 KB
testcase_65 AC 19 ms
6,944 KB
testcase_66 WA -
testcase_67 AC 20 ms
6,940 KB
testcase_68 WA -
testcase_69 AC 20 ms
6,940 KB
testcase_70 AC 20 ms
6,944 KB
testcase_71 WA -
testcase_72 WA -
testcase_73 AC 20 ms
6,944 KB
testcase_74 AC 20 ms
6,940 KB
testcase_75 AC 21 ms
6,940 KB
testcase_76 AC 20 ms
6,940 KB
testcase_77 AC 20 ms
6,944 KB
testcase_78 AC 21 ms
6,944 KB
testcase_79 AC 22 ms
6,944 KB
testcase_80 AC 22 ms
6,940 KB
testcase_81 AC 22 ms
6,940 KB
testcase_82 AC 21 ms
6,944 KB
testcase_83 AC 22 ms
6,940 KB
testcase_84 AC 22 ms
6,940 KB
testcase_85 AC 22 ms
6,940 KB
testcase_86 AC 22 ms
6,940 KB
testcase_87 AC 22 ms
6,940 KB
testcase_88 AC 21 ms
6,944 KB
testcase_89 AC 22 ms
6,940 KB
testcase_90 AC 22 ms
6,944 KB
testcase_91 AC 23 ms
6,944 KB
testcase_92 AC 22 ms
6,940 KB
testcase_93 AC 22 ms
6,940 KB
testcase_94 AC 22 ms
6,944 KB
testcase_95 AC 24 ms
6,940 KB
testcase_96 AC 22 ms
6,944 KB
testcase_97 AC 24 ms
6,940 KB
testcase_98 AC 19 ms
6,940 KB
testcase_99 AC 22 ms
6,940 KB
testcase_100 AC 23 ms
6,944 KB
testcase_101 AC 20 ms
6,944 KB
testcase_102 AC 20 ms
6,944 KB
testcase_103 AC 23 ms
6,944 KB
testcase_104 AC 2 ms
6,940 KB
testcase_105 AC 2 ms
6,940 KB
testcase_106 WA -
testcase_107 AC 2 ms
6,940 KB
testcase_108 AC 1 ms
6,940 KB
testcase_109 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;
#define FI first
#define SE second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))

int N, X;
void BAD()
{
    REP(_, X) printf("0");
    exit(0);
}

int main()
{
    cin >> N >> X;
    vector<lint> A(N);
    cin >> A;
	vector<int> ok(X + 1);
	lint p = 1;
	for (auto a : A)
	{
		p *= (a + 1);
		if (p > X)
		{
			BAD();
		}
		IFOR(i, 1, X + 1) if (ok[i])
		{
			if (i * (a + 1) <= X) ok[i * (a + 1)] = 1;
		}
		ok[a + 1] = 1;
	}
	string ret;
	REP(_, X + 3) ret += '0';
	
	ret[p - 1] = '1';
	
	FOR(i, 2, X + 1) if (ok[i])
	{
		int d = i - 1;
		for (int now = p - 1; now <= X; now += d) ret[now] = '1';
	} 
	FOR(i, 1, X + 1) printf("%c", ret[i]);
}
0