結果

問題 No.2247 01 ZigZag
ユーザー SarievoSarievo
提出日時 2023-03-17 22:48:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 5,421 bytes
コンパイル時間 5,058 ms
コンパイル使用メモリ 290,500 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-18 11:57:35
合計ジャッジ時間 6,589 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 3 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 2 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 2 ms
5,376 KB
testcase_45 WA -
testcase_46 AC 2 ms
5,376 KB
testcase_47 AC 2 ms
5,376 KB
testcase_48 AC 2 ms
5,376 KB
testcase_49 AC 2 ms
5,376 KB
testcase_50 AC 2 ms
5,376 KB
testcase_51 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
/* --- ACL --- */
#if __has_include(<atcoder/all>)
#include <atcoder/all>
// using mint = atcoder::modint998244353;
// using mint = atcoder::modint1000000007;
#endif
/* --- PBDS, reference: https://codeforces.com/blog/entry/11080 --- */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using IndexSet=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class T> using IndexMultiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
/* --- CUSTOM HASH, reference: https://codeforces.com/blog/entry/62393 --- */
struct MyHash {
  static uint64_t splitmix64(uint64_t x){x+=0x9e3779b97f4a7c15;x=(x^(x>>30))*0xbf58476d1ce4e5b9;x=(x^(x>>27))*0x94d049bb133111eb;return x^(x>>31);}
  size_t operator()(uint64_t x) const{static const uint64_t FIXED_RANDOM=chrono::steady_clock::now().time_since_epoch().count();return splitmix64(x+FIXED_RANDOM);}
};
template<class T> using us=unordered_set<T, MyHash>;template<class T,class U> using um=unordered_map<T,U,MyHash>;
using ll=long long;using ull=unsigned long long;using ld=long double;
const int MOD=1000000007;
// const int MOD=998244353;
const ll NX[]{+0,+1,+0,-1,+1,+1,-1,-1};
const ll NY[]{+1,+0,-1,+0,+1,-1,-1,+1};
const ll INF64=0x1fffffffffffffff;
template<class T> using v=vector<T>;template<class T> using vv=v<v<T>>;template<class T> using vvv=v<vv<T>>;
using vl=v<ll>;using vvl=vv<ll>;using vi=v<int>;using vvi=vv<int>;using vs=v<string>;
using vb=v<bool>;using vd=v<ld>;using pl=pair<ll,ll>;using vp=v<pl>;using pd=pair<ld,ld>;using vpd=v<pd>;
template<class T> using pqg=priority_queue<T,vector<T>,greater<T>>;
#define overload3(a, b, c, name, ...) name
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i, n) for(ll i=0;i<n;++i)
#define rep3(i, a, b) for(ll i=a;i<b;++i)
#define rep(...) overload3(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i=n;i--;)
#define rrep2(i, n) for(ll i=n;i--;)
#define rrep3(i, a, b) for(ll i=b;i-->(a);)
#define rrep(...) overload3(__VA_ARGS__,rrep3,rrep2,rrep1)(__VA_ARGS__)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sm(...) accumulate(all(__VA_ARGS__),0LL)
#define CASE ll _t; cin >> _t; while (_t--)
#define dbg(v) cout << "Line(" << __LINE__ << ") -> " << #v << " = " << (v) << endl;
#define YESNO(yes,no)void yes(bool i=1){cout<<(i?#yes:#no)<<'\n';}void no(){cout<<(#no)<<'\n';}
YESNO(first,second)YESNO(First,Second)YESNO(Yes,No)YESNO(YES,NO)YESNO(possible,impossible)YESNO(POSSIBLE,IMPOSSIBLE)
vector<ll> iota(ll n,ll begin=0){vector<ll>a(n);iota(all(a),begin);return a;}
vector<ll> divisors(ull x){vector<ll>ans;for(ull i=1;i*i<=x;i++)if(x%i==0){ans.push_back(i);}for(int i=(ans.size()-(ans.back()*ans.back()==x));i--;){ans.push_back(x/ans[i]);}return ans;}
vector<pl> factorize(ull x){vector<pl>ans;for(ull i=2;i*i<=x;i++)if(x%i==0){ans.push_back({i,1});while((x/=i)%i==0)ans.back().second++;}if(x!=1)ans.push_back({x,1});return ans;}
ll intpow(ll a,ll b){ll ans=1;while(b){if(b&1)ans*=a;a*=a;b/=2;}return ans;}ll intpow(ll a,ll b,ll p){ll ans=1;while(b){if(b&1)(ans*=a)%=p;(a*=a)%=p;b/=2;}return ans;}
ll popcnt(ull a){return __builtin_popcountll(a);}
template<class T>void distinct(T&a){sort(all(a));a.erase(unique(all(a)),end(a));}
template<class T,class F>void filter(T&a,F b){a.erase(remove_if(all(a),not_fn(b)),a.end());}
template<class T>bool chmin(T&a,const T&b){if(a<=b)return 0;a=b;return 1;}template<class T,class U>bool chmin(T&a,const U&b){return chmin(a,(T)b);}
template<class T>bool chmax(T&a,const T&b){if(a>=b)return 0;a=b;return 1;}template<class T,class U>bool chmax(T&a,const U&b){return chmax(a,(T)b);}
template<typename T,typename U>ostream&operator<<(ostream&os,pair<T,U>&p){os<<p.first<<" "<<p.second;return os;}
template<typename T,typename U>istream&operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<typename T>ostream&operator<<(ostream&os,vector<T>&v){for(auto it=v.begin();it!=v.end();){os<<*it<<((++it)!=v.end()?" ":"");}return os;}
template<typename T>istream&operator>>(istream&is,vector<T>&v){for(T&e:v)is>>e;return is;}
struct Nyan{Nyan(){cin.tie(nullptr)->sync_with_stdio(0);fixed(cout).precision(12);}}NYAAN;
//////////////////////////// SOLVING BEGIN ////////////////////////////

signed main() {
  ll n, m, k;
  cin >> n >> m >> k;

  if (n + m < k + 1) {
    cout << -1 << '\n';
    return 0;
  }

  if (!n || !m) {
    if (k) {
      cout << -1 << '\n';
    } else {
      if (!m) {
        cout << string(n+m, '0') << '\n';
      } else {
        cout << string(n+m, '1') << '\n';
      }
    }
    return 0;
  }

  ll minx = min(n, m);
  ll avax = minx * 2;
  if (k > avax) {
    cout << -1 << '\n';
    return 0;
  }

  ll et = k / 2;
  string avas(minx + et, '1');
  for(int i = 1, j = 0; i < avas.size(), j < et; i += 2, j++) {
    avas[i] = '0';
  }
  // if (k%2==0) avas.push_back('1');
  // cout << avas << '\n';

  ll sz = avas.size();
  string ans;
  // 2 CASES
  if (n <= m) {
    ans = string(n+m, '1');
    for(auto&&ch:avas) {
      if (ch=='1') ch='0';
      else ch='1';
    }
    reverse(all(avas));
    rep(i, sz) {
      ans[i]=avas[i];
    }
  } else {
    ans = string(n+m, '0');
    rep(i, (ans.size()-sz), ans.size()) {
      ans[i] = avas[i-(ans.size()-sz)];
    }
  }

  cout << ans << '\n';
}
0