結果
問題 | No.2247 01 ZigZag |
ユーザー |
![]() |
提出日時 | 2023-03-18 07:57:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,507 bytes |
コンパイル時間 | 3,975 ms |
コンパイル使用メモリ | 251,512 KB |
最終ジャッジ日時 | 2025-02-11 14:59:06 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 WA * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; //using mint = static_modint<998244353>; //using mint = modint; using mint = static_modint<1000000007>; using vm = vector<mint>; using vvm = vector<vm>; ostream &operator<<(ostream &o,const mint &m){cout<<m.val();return o;} using ll = long long; using vl = vector<ll>; using vvl = vector<vl>; using pl = pair<ll,ll>; #define rep(i,n) for(ll i=0;i<(ll)(n);++i) #define reps(i,s,n) for(ll i=(s);i<(ll)(n);++i) #define rep1(i,n) for(ll i=1;i<=(ll)(n);++i) #define ts(i) to_string(i) #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) const long long INF = 1e18; #ifdef DEBUG #include <debug.hpp> #endif string solve(){ ll N,M,K; cin >> N>>M>>K; #ifdef DEBUG cout<<"N="<<N<<" M="<<M<<" K="<<K<<endl; #endif string s=""; if(K==0){ if(N>0&&M>0) return "-1"; if(N>0){ rep(i,N)s+='0'; }else{ rep(i,M)s+='1'; } return s; } string v0="",v1=""; ll a,b; if(K%2){ a=(K+1)/2;b=(K+1)/2; }else{ a=K/2+1;b=K/2; } #ifdef DEBUG cout<<"a="<<a<<" b="<<b<<endl; #endif if(a>N||b>M)return "-1"; //N,M short rep(i,N-a){ v0+='0'; } rep(i,K+1){ if(i%2)v0+='1'; else v0+='0'; } v1='1'; rep(i,N-a){ v1+='0'; } rep(i,K-1){ if(i%2)v1+='1'; else v1+='0'; } if(v0>v1)s=v1; else s=v0; return s; } int main(){ #ifdef DEBUG cout << "--- Input ---" << endl; #endif #ifdef DEBUG cout << "--- Answer ---" << endl; #endif cout<<solve()<<endl; } //cout << fixed << setprecision(9);