結果
問題 | No.493 とても長い数列と文字列(Long Long Sequence and a String) |
ユーザー | char134217728 |
提出日時 | 2017-12-30 01:16:46 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,447 bytes |
コンパイル時間 | 2,424 ms |
コンパイル使用メモリ | 207,476 KB |
実行使用メモリ | 13,644 KB |
最終ジャッジ日時 | 2024-12-21 11:07:03 |
合計ジャッジ時間 | 96,784 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
13,632 KB |
testcase_01 | AC | 2 ms
10,020 KB |
testcase_02 | AC | 2 ms
13,632 KB |
testcase_03 | AC | 2 ms
10,020 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 2 ms
10,020 KB |
testcase_07 | AC | 2 ms
10,020 KB |
testcase_08 | AC | 2 ms
10,024 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | TLE | - |
testcase_60 | TLE | - |
testcase_61 | TLE | - |
testcase_62 | TLE | - |
testcase_63 | TLE | - |
testcase_64 | TLE | - |
testcase_65 | TLE | - |
testcase_66 | TLE | - |
testcase_67 | TLE | - |
testcase_68 | TLE | - |
testcase_69 | TLE | - |
testcase_70 | TLE | - |
testcase_71 | TLE | - |
testcase_72 | TLE | - |
testcase_73 | TLE | - |
testcase_74 | TLE | - |
testcase_75 | TLE | - |
testcase_76 | TLE | - |
testcase_77 | TLE | - |
testcase_78 | TLE | - |
testcase_79 | TLE | - |
testcase_80 | TLE | - |
testcase_81 | TLE | - |
testcase_82 | TLE | - |
testcase_83 | TLE | - |
testcase_84 | TLE | - |
testcase_85 | TLE | - |
testcase_86 | TLE | - |
testcase_87 | TLE | - |
testcase_88 | TLE | - |
testcase_89 | TLE | - |
testcase_90 | TLE | - |
testcase_91 | TLE | - |
testcase_92 | TLE | - |
testcase_93 | TLE | - |
testcase_94 | TLE | - |
testcase_95 | TLE | - |
testcase_96 | TLE | - |
testcase_97 | TLE | - |
testcase_98 | TLE | - |
testcase_99 | TLE | - |
testcase_100 | TLE | - |
testcase_101 | TLE | - |
testcase_102 | TLE | - |
testcase_103 | TLE | - |
testcase_104 | TLE | - |
testcase_105 | TLE | - |
testcase_106 | TLE | - |
testcase_107 | TLE | - |
testcase_108 | TLE | - |
testcase_109 | WA | - |
testcase_110 | RE | - |
testcase_111 | RE | - |
testcase_112 | RE | - |
testcase_113 | RE | - |
testcase_114 | RE | - |
testcase_115 | RE | - |
testcase_116 | RE | - |
testcase_117 | RE | - |
testcase_118 | WA | - |
コンパイルメッセージ
main.cpp:76:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 76 | main(){ | ^~~~
ソースコード
#include <bits/stdc++.h> #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define FORR(i,a,b) for (int i=(a);i>=(b);i--) #define pb push_back #define pcnt __builtin_popcount #define show(x) cout<<#x<<" = "<<x<<endl; #define maxs(x,y) x = max(x,y) #define mins(x,y) x = min(x,y) #define fi first #define se second #define rng(a) a.begin(),a.end() #define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++) #define sz(x) (int)(x).size() #define mp make_pair using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vpii; typedef set<int> si; typedef pair<ll,ll> pll; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<pll> vpll; typedef set<ll> sl; template<typename T>string join(vector<T>&v) {stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);} ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;} int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;} void dout(double d){printf("%.12f\n",d);} const int iinf = 1e9; const ll linf = 1e18; const int mod = 1e9+7; const double pi = acos(-1); const double eps = 1e-10; ll a[61][3]; string st[61]; pair<int, pll> parse(ll n){ ll s=0, p=1; int l = 0, c, nn = n * n; stringstream ss; ss << nn; st[n] = ss.str(); while(nn > 0){ l++; c = nn % 10; s += c; p *= (c == 0 ? 10 : c); nn /= 10; } return mp(l, mp(s, p)); } pll search(int n, ll l, ll r){ if(n == 0 || l >= r) return mp(0, 1); pll t; ll s = 0, p = 1, d; t = search(n-1, l, min(r, a[n-1][0])); s = (s + t.fi)%mod; p = p * t.se % mod; FOR(i, max(0ll, min(l-a[n-1][0], ll(sz(st[n])))), min(ll(sz(st[n])), r-a[n-1][0])){ d = st[n][i] - '0'; s += d; p *= (d == 0 ? 10 : d); } s %= mod; p %= mod; d = a[n-1][0] + sz(st[n]); t = search(n-1, max(l-d, 0ll), r-d); s = (s + t.fi)%mod; p = p * t.se % mod; return mp(s, p); } main(){ cin.tie(0); ios::sync_with_stdio(false); a[0][2] = 1; pair<int, pll> t; FOR(i, 1, 61){ t = parse(i); a[i][0] = (a[i-1][0] * 2 + t.fi); a[i][1] = (a[i-1][1] * 2 + t.se.fi)%mod; a[i][2] = a[i-1][2] * a[i-1][2] % mod * t.se.se % mod; } int K; ll L, R; cin >> K >> L >> R; if(a[K][0] < R){ cout << -1 << endl; return 0; } pll ans = search(K, L-1, R); cout << ans.fi << " " << ans.se << endl; return 0; }