結果
問題 | No.2247 01 ZigZag |
ユーザー | UMRgurashi |
提出日時 | 2023-03-17 22:40:47 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 5,349 bytes |
コンパイル時間 | 4,918 ms |
コンパイル使用メモリ | 276,784 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-18 11:46:06 |
合計ジャッジ時間 | 6,415 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,816 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 3 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,944 KB |
testcase_05 | AC | 3 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 3 ms
6,940 KB |
testcase_09 | AC | 3 ms
6,944 KB |
testcase_10 | AC | 3 ms
6,944 KB |
testcase_11 | AC | 2 ms
6,940 KB |
testcase_12 | AC | 3 ms
6,940 KB |
testcase_13 | AC | 3 ms
6,940 KB |
testcase_14 | AC | 2 ms
6,940 KB |
testcase_15 | AC | 2 ms
6,944 KB |
testcase_16 | AC | 3 ms
6,940 KB |
testcase_17 | AC | 3 ms
6,944 KB |
testcase_18 | AC | 2 ms
6,944 KB |
testcase_19 | AC | 3 ms
6,940 KB |
testcase_20 | AC | 3 ms
6,940 KB |
testcase_21 | AC | 2 ms
6,940 KB |
testcase_22 | AC | 3 ms
6,940 KB |
testcase_23 | AC | 2 ms
6,944 KB |
testcase_24 | AC | 2 ms
6,944 KB |
testcase_25 | AC | 3 ms
6,940 KB |
testcase_26 | AC | 3 ms
6,940 KB |
testcase_27 | AC | 3 ms
6,944 KB |
testcase_28 | AC | 3 ms
6,940 KB |
testcase_29 | AC | 2 ms
6,940 KB |
testcase_30 | AC | 3 ms
6,940 KB |
testcase_31 | AC | 3 ms
6,940 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | AC | 2 ms
6,940 KB |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | AC | 2 ms
6,940 KB |
testcase_41 | AC | 3 ms
6,940 KB |
testcase_42 | WA | - |
testcase_43 | AC | 3 ms
6,944 KB |
testcase_44 | AC | 2 ms
6,940 KB |
testcase_45 | AC | 4 ms
6,944 KB |
testcase_46 | AC | 4 ms
6,944 KB |
testcase_47 | AC | 2 ms
6,940 KB |
testcase_48 | AC | 2 ms
6,944 KB |
testcase_49 | AC | 2 ms
6,944 KB |
testcase_50 | AC | 2 ms
6,944 KB |
testcase_51 | AC | 2 ms
6,940 KB |
ソースコード
#include <bits/stdc++.h> #include <cstdlib> #include <chrono> //using namespace chrono; #include <atcoder/all> using namespace atcoder; #define int long long #define double long double #define stoi stoll //#define endl "\n" using std::abs; using namespace std; //constexpr int MOD = 1000000007; //constexpr int MOD = 998244353; //using mint = modint1000000007; //using mint = modint998244353; constexpr double PI = 3.14159265358979323846; const int INF = 1LL << 62; #define rep(i,n) for(int i=0;i<n;++i) #define REP(i,n) for(int i=1;i<=n;i++) #define sREP(i,n) for(int i=1;i*i<=n;++i) #define krep(i,k,n) for(int i=(k);i<n+k;i++) #define Krep(i,k,n) for(int i=(k);i<n;i++) #define rrep(i,n) for(int i=n-1;i>=0;i--) #define Rrep(i,n) for(int i=n;i>0;i--) #define frep(i,n) for(auto &x:n) #define LAST(x) x[x.size()-1] #define ALL(x) (x).begin(),(x).end() #define MAX(x) *max_element(ALL(x)) #define MIN(x) *min_element(ALL(x) #define RUD(a,b) (((a)+(b)-1)/(b)) #define sum1_n(n) ((n)*(n+1)/2) #define SUM1n2(n) (n*(2*n+1)*(n+1))/6 #define SUMkn(k,n) (SUM1n(n)-SUM1n(k-1)) #define SZ(x) ((int)(x).size()) #define PB push_back #define Fi first #define Se second template<class... T> constexpr auto min(T... a) { return min(initializer_list<common_type_t<T...>>{a...}); } template<class... T> constexpr auto max(T... a) { return max(initializer_list<common_type_t<T...>>{a...}); } template<class... T> void in(T&... a) { (cin >> ... >> a); } int ini() { int x; cin >> x; return x; } string ins() { string x; cin >> x; return x; } template <class T> using v = vector<T>; template <class T> using vv = vector<v<T>>; template <class T> using vvv = vector<vv<T>>; using pint = pair<int, int>; using tint = tuple<int, int, int>; using qint = tuple<int, int, int, int>; double LOG(int a, int b) { return log(b) / log(a); } double DISTANCE(int x1, int y1, int x2, int y2) { return sqrt(abs(x1 - x2) * abs(x1 - x2) + abs(y1 - y2) * abs(y1 - y2)); } inline bool BETWEEN(int x, int min, int max) { if (min <= x && x <= max) return true; else return false; } inline bool between(int x, int min, int max) { if (min < x && x < max) return true; else return false; } inline bool BETWEEN2(int i, int j, int H, int W) { if (BETWEEN(i, 0, H - 1) && BETWEEN(j, 0, W - 1)) return true; else return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } inline bool bit(int x, int i) { return x >> i & 1; } void yn(bool x) { if (x) { cout << "Yes" << endl; } else { cout << "No" << endl; } } void YN(bool x) { if (x) { cout << "YES" << endl; } else { cout << "NO" << endl; } } int ipow(int x, int n) { int ans = 1; while (n > 0) { if (n & 1) ans *= x; x *= x; n >>= 1; } return ans; } template <typename T> vector<T> compress(vector<T>& X) { vector<T> vals = X; sort(ALL(vals)); vals.erase(unique(ALL(vals)), vals.end()); rep(i, SZ(X)) X[i] = lower_bound(ALL(vals), X[i]) - vals.begin(); return vals; } v<pint> prime_factorize(int N) { v<pint> res; for (int i = 2; i * i <= N; i++) { if (N % i != 0) continue; int ex = 0; while (N % i == 0) { ++ex; N /= i; } res.push_back({ i, ex }); } if (N != 1) res.push_back({ N, 1 }); return res; } struct Eratosthenes { v<bool> isprime; // 整数 i を割り切る最小の素数 v<int> minfactor; Eratosthenes(int N) : isprime(N + 1, true), minfactor(N + 1, -1) { isprime[1] = false; minfactor[1] = 1; for (int p = 2; p <= N; ++p) { if (!isprime[p]) continue; minfactor[p] = p; for (int q = p * 2; q <= N; q += p) { isprime[q] = false; if (minfactor[q] == -1) minfactor[q] = p; } } } v<pint> factorize(int n) { v<pint> res; while (n > 1) { int p = minfactor[n]; int exp = 0; while (minfactor[n] == p) { n /= p; ++exp; } res.emplace_back(p, exp); } return res; } }; int number_of_divisors(v<pint> p) { int ans = 1; for (pint x : p) { ans *= x.second + 1; } return ans; } int sum_ob_divisors(v<pint> p) { int ans = 1; for (pint x : p) { } return ans; } bool is_squere(long long N) { long long r = (long long)floor(sqrt((double)N)); return (r * r) == N; } void solve() { int N, M, K; in(N, M, K); if (N + M < 20) { v<string> vs; rep(i, (1LL << (N+M))) { int n = 0, m = 0, k = 0; string ans = ""; rep(j, N+M) { if (bit(i, j)) ans += "0"; else ans += "1"; } rep(j, N + M) { if (ans[j] == '0') n++; else m++; } rep(j, N + M-1) { if (ans[j] != ans[j + 1])k++; } if (N == n && M == m && K == k)vs.push_back(ans); } sort(ALL(vs)); if (SZ(vs) == 0)cout << -1; else cout << vs[0]; return; } if (K == 0 && N > 0 && M > 0) { cout << -1; return; } string ans = "", ans2 = "", ans3 = ""; rep(i, (K+1)/2)ans2 += "01", N--, M--; rep(i, M)ans3 += "1"; rep(i, N)ans += "0"; reverse(ALL(ans)); if (K % 2 == 0) { ans = ""; N--; rep(i, N)ans += "0"; ans3 = ans3 + "0"; } if (N < 0 || M < 0) cout << -1; else cout << ans + ans2 + ans3 << endl; } signed main() { //ios::sync_with_stdio(false); //cin.tie(nullptr); cout << fixed << setprecision(14); //cout << setfill('0') << right << setw(4)<< solve(); }