結果

問題 No.1389 Clumsy Calculation
ユーザー lorent_kyoprolorent_kyopro
提出日時 2021-02-12 22:10:45
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 3,295 bytes
コンパイル時間 1,915 ms
コンパイル使用メモリ 203,340 KB
実行使用メモリ 4,872 KB
最終ジャッジ日時 2023-09-27 04:25:04
合計ジャッジ時間 3,820 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 28 ms
4,676 KB
testcase_10 AC 14 ms
4,668 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 24 ms
4,632 KB
testcase_15 AC 23 ms
4,628 KB
testcase_16 AC 23 ms
4,756 KB
testcase_17 AC 24 ms
4,556 KB
testcase_18 AC 24 ms
4,680 KB
testcase_19 AC 25 ms
4,620 KB
testcase_20 AC 25 ms
4,628 KB
testcase_21 AC 25 ms
4,556 KB
testcase_22 AC 25 ms
4,668 KB
testcase_23 AC 25 ms
4,564 KB
testcase_24 AC 25 ms
4,736 KB
testcase_25 AC 25 ms
4,676 KB
testcase_26 AC 22 ms
4,676 KB
testcase_27 AC 24 ms
4,872 KB
testcase_28 AC 24 ms
4,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(v) v.begin(), v.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using ld = long double;
const array<int, 8> di = {0, 1, 0, -1, 1, 1, -1, -1}, dj = {1, 0, -1, 0, 1, -1, -1, 1};
const array<string, 2> YESNO = {"NO", "YES"};
const array<string, 2> YesNo = {"No", "Yes"};
const array<string, 2> yesno = {"no", "yes"};
void YES(bool b = true) { cout << YESNO[b] << '\n'; }
void Yes(bool b = true) { cout << YesNo[b] << '\n'; }
void yes(bool b = true) { cout << yesno[b] << '\n'; }
template<typename T, typename U>
inline bool chmax(T& a, const U& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U>
inline bool chmin(T& a, const U& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T>
T MAX(const vector<T>& v) { return *max_element(v.begin(), v.end()); }
template<typename T>
T MIN(const vector<T>& v) { return *min_element(v.begin(), v.end()); }
template<typename T>
T SUM(const vector<T>& v) { return accumulate(v.begin(), v.end(), T()); }
template<typename T>
void UNIQUE(vector<T>& v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
}
template<typename T>
T POW(T a, int n) {
    T res = 1;
    for (; n > 0; n >>= 1, a *= a) if (n & 1) res *= a;
    return res;
}
template<typename T>
int lb(const vector<T>& v, T x) {
    return distance(v.begin(), lower_bound(v.begin(), v.end(), x));
}
template<typename T>
int ub(const vector<T>& v, T x) {
    return distance(v.begin(), upper_bound(v.begin(), v.end(), x));
}
/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for (auto it = v.begin(); it != v.end(); ++it) {
        if (it == v.begin()) os << *it;
        else os << ' ' << *it;
    }
    return os;
}
template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << p.first << ' ' << p.second;
    return os;
}
__attribute__((constructor))
void setup() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
}
// #include <atcoder/all>
// using namespace atcoder;
// using mint = modint1000000007;
// using mint = modint998244353;

int main() {
    ll n, x;
    cin >> n >> x;
    vector<ll> s(n);
    rep(i, n) cin >> s[i];
    ll ans = n*x - SUM(s);
    ans = x - ans;
    cout << ans << '\n';
}
0