結果
問題 | No.438 Cwwプログラミング入門 |
ユーザー | togari_takamoto |
提出日時 | 2016-10-28 23:26:37 |
言語 | C++11 (gcc 11.4.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,802 bytes |
コンパイル時間 | 1,649 ms |
コンパイル使用メモリ | 150,288 KB |
実行使用メモリ | 569,868 KB |
最終ジャッジ日時 | 2023-08-16 08:10:44 |
合計ジャッジ時間 | 5,463 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
8,768 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,384 KB |
testcase_03 | AC | 2 ms
4,384 KB |
testcase_04 | MLE | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
testcase_60 | -- | - |
testcase_61 | -- | - |
testcase_62 | -- | - |
testcase_63 | -- | - |
testcase_64 | -- | - |
testcase_65 | -- | - |
testcase_66 | -- | - |
testcase_67 | -- | - |
testcase_68 | -- | - |
testcase_69 | -- | - |
testcase_70 | -- | - |
testcase_71 | -- | - |
testcase_72 | -- | - |
testcase_73 | -- | - |
testcase_74 | -- | - |
testcase_75 | -- | - |
testcase_76 | -- | - |
testcase_77 | -- | - |
testcase_78 | -- | - |
testcase_79 | -- | - |
testcase_80 | -- | - |
testcase_81 | -- | - |
testcase_82 | -- | - |
testcase_83 | -- | - |
testcase_84 | -- | - |
testcase_85 | -- | - |
testcase_86 | -- | - |
testcase_87 | -- | - |
testcase_88 | -- | - |
testcase_89 | -- | - |
testcase_90 | -- | - |
testcase_91 | -- | - |
testcase_92 | -- | - |
testcase_93 | -- | - |
testcase_94 | -- | - |
testcase_95 | -- | - |
testcase_96 | -- | - |
testcase_97 | -- | - |
testcase_98 | -- | - |
testcase_99 | -- | - |
testcase_100 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using u32 = uint32_t; using vi = vector<int>; using vvi = vector<vi>; using vb = vector<bool>; using vvb = vector<vb>; using vl = vector<ll>; using vvl = vector<vl>; using vd = vector<double>; using vvd = vector<vd>; #define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i) #define ALL(c) (c).begin(), (c).end() #define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i) #define TEN(x) ((ll)1e##x) const ll mod = TEN(9) + 7; ll extgcd(ll a, ll b, ll *x, ll *y) { if (b == 0) return (*x = (a<0) ? -1 : 1), *y = 0, abs(a); ll d = extgcd(b, a%b, y, x); return *y -= a / b*(*x), d; } int main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(50); ll a, b, c; cin >> a >> b >> c; ll x, y; ll d = extgcd(a, b, &x, &y); auto cww = [&](ll x, ll y, ll c, const string & s) { string C = "c", W = "w"; if (c % d) return false; x *= c / d; y *= c / d; string ans; if (x < 0) { REP(i, -x) ans += C; REP(i, y) ans += W; REP(i, y - 1) ans += "C"; REP(i, -x) ans += "W"; } else if (y < 0) { REP(i, -y) ans += W; REP(i, x) ans += C; REP(i, x - 1) ans += "C"; REP(i, -y) ans += "W"; } else { REP(i, x) ans += C; REP(i, y) ans += W; REP(i, y + x - 1) ans += "C"; } if (s.size() + ans.size() <= 10000) { cout << s << ans << endl; return true; } return false; }; string s; REP(i, c / a) { if (s.size() >= 10000) break; if (cww(x, y, c - i*a, s)) return 0; if (i == 0) s = "c"; s += "cC"; } s = "" ; REP(i, c / b) { if (s.size() >= 10000) break; if (cww(x, y, c - i*b, s)) return 0; if (i == 0) s = "w"; s += "wC"; } cout << "mourennaihasimasenn" << endl; return 0; }