結果

問題 No.492 IOI数列
ユーザー xuzijian629xuzijian629
提出日時 2018-09-11 10:16:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 55 ms / 1,000 ms
コード長 2,107 bytes
コンパイル時間 1,032 ms
コンパイル使用メモリ 101,320 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-05 06:54:12
合計ジャッジ時間 2,719 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 55 ms
4,388 KB
testcase_06 AC 10 ms
4,384 KB
testcase_07 AC 35 ms
4,384 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 21 ms
4,380 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,384 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,384 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,384 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 9 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <chrono>
#include <random>
#include <functional>
#include <utility>
#include <cassert>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "STACK:36777216")
using namespace std;
using i64 = int64_t;
constexpr i64 MOD = 1e9 + 7;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
using vi = vector<i64>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ii = pair<i64, i64>;

i64 tmp[] = {1,568658242,832989125,964713680,432717573,865999464,735084983,588059454,834230221,314653273,421935805,244213913,499865885,806688401,709661070,3368271,207231765,170842191,827693172,146063335,960280099,966692748,461319921,315013999,315391517,588888893,51320231,320055902,684924180,384456174,797022895,14153804,367300832,48054659,484574239,560466957,4644675,389023,788082206,455179231,198885522,840681663,758718052,41061196,350742828,601928613,408922199,148427570,302573877,376573500,144300001,478837572,431568836,185203966,327504435,430091869,417874738,421521591,682840839,622404319,296328424,970884251,734888505,903100813,478433713,91690004,254048209,881130177,473847831,849538152,104286961,902479973,955740468,856586321,945512322,588744593,241410053,993457327,583703689,650561389,712458802,979471021,958467374,422206051,62266485,77592561,337918007,660154005,703985793,404410458,17797199,332634843,756007764,278415043,181039352,868784608,583986413,368933151,348032305,490943380,24430014};

i64 get(i64 n) {
    i64 rem = tmp[n / i64(1e7)];
    for (int i = n / i64(1e7) * i64(1e7); i < n; i++) {
        rem *= 100;
        rem += 1;
        rem %= MOD;
    }
    return rem;
}

vector<string> ans2 = {"0", "1"};

int main() {
    i64 n;
    cin >> n;
    i64 m = n;
    n = (n - 1) % (MOD - 1);
    cout << get(n) << endl;
    for (int i = 0; i < 12; i++) {
        ans2.push_back(ans2.back() + "01");
    }
    cout << ans2[m % 11] << endl;
}
0