結果
問題 | No.1632 Sorting Integers (GCD of M) |
ユーザー | nawawan |
提出日時 | 2021-07-30 22:56:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,877 bytes |
コンパイル時間 | 1,629 ms |
コンパイル使用メモリ | 168,984 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 02:44:35 |
合計ジャッジ時間 | 3,222 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | WA | - |
testcase_20 | AC | 2 ms
5,376 KB |
testcase_21 | WA | - |
testcase_22 | AC | 2 ms
5,376 KB |
testcase_23 | AC | 2 ms
5,376 KB |
testcase_24 | AC | 2 ms
5,376 KB |
testcase_25 | AC | 2 ms
5,376 KB |
testcase_26 | WA | - |
testcase_27 | AC | 2 ms
5,376 KB |
testcase_28 | AC | 2 ms
5,376 KB |
testcase_29 | AC | 2 ms
5,376 KB |
testcase_30 | AC | 2 ms
5,376 KB |
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 | WA | - |
testcase_35 | AC | 2 ms
5,376 KB |
testcase_36 | AC | 2 ms
5,376 KB |
testcase_37 | WA | - |
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 | WA | - |
testcase_44 | AC | 2 ms
5,376 KB |
testcase_45 | AC | 2 ms
5,376 KB |
testcase_46 | WA | - |
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 | AC | 2 ms
5,376 KB |
testcase_52 | AC | 2 ms
5,376 KB |
testcase_53 | AC | 2 ms
5,376 KB |
testcase_54 | AC | 2 ms
5,376 KB |
testcase_55 | AC | 2 ms
5,376 KB |
testcase_56 | AC | 2 ms
5,376 KB |
testcase_57 | AC | 2 ms
5,376 KB |
testcase_58 | AC | 2 ms
5,376 KB |
testcase_59 | AC | 2 ms
5,376 KB |
testcase_60 | AC | 2 ms
5,376 KB |
testcase_61 | AC | 2 ms
5,376 KB |
testcase_62 | AC | 2 ms
5,376 KB |
ソースコード
#include <bits/stdc++.h>using namespace std;template<const int MOD> struct modint{long long val;modint(): val(0) {}modint(long long x){if(x < 0) val = x % MOD + MOD;else val = x % MOD;}modint(const modint &t){val = t.val;}modint& operator =(const modint m){val = m.val;return *this;}modint operator -(){return modint(-val);}modint& operator-=(const modint &m){val -= m.val;if(val < 0) val += MOD;return *this;}modint& operator+=(const modint &m){val += m.val;if(val >= MOD) val -= MOD;return *this;}modint& operator*=(const modint &m){val *= m.val;val %= MOD;return *this;}modint& operator/=(modint m){*this *= m.inv();return *this;}modint inv(){long long x = 1, y = 0;long long a = val, b = MOD;while(b != 0){long long t = a / b;a -= t * b;x -= t * y;swap(a, b);swap(x, y);}x %= MOD;if(x < 0) x += MOD;return modint(x);}modint pow(long long k){long long res = 1;long long v = val;while(k > 0){if(k & 1) res = res * v % MOD;v = v * v % MOD;k >>= 1;}return modint(res);}bool operator==(const modint &m){return val == m.val;}modint operator+(const modint &m){return modint(*this) += m;}modint operator-(const modint &m){return modint(*this) -= m;}modint operator*(const modint &m){return modint(*this) *= m;}modint operator/(const modint &m){return modint(*this) /= m;}bool operator!=(const modint &m){return modint(*this).val != m.val;}bool operator!=(const int &m){return modint(*this).val != m;}};const int MOD = 1000000007;using mint = modint<MOD>;int main(){int N;cin >> N;vector<long long> c(9);for(int i = 0; i < 9; i++) cin >> c[i];for(int i = 0; i < 9; i++){if(c[i] == N){mint ten = 10;mint ans = 0;ans = (ten.pow(N) - 1) / 9 * (i + 1);cout << ans.val << endl;return 0;}}bool f = true;long long sum = 0;for(long long i = 0; i < 9; i++){if(i % 2 == 0 && c[i] > 0) f = false;sum += c[i] * (i + 1);}int ans = 1;if(f) ans *= 2;if(c[3] + c[7] == N){ans = 4;}if(c[0] + c[7] == N){if(N % 6 == 0) ans = 7;}if(sum % 9 == 0){cout << 9 * ans << endl;}else if(sum % 3 == 0){cout << 3 * ans << endl;}else cout << ans << endl;}