結果

問題 No.3654 Cup Ramen
コンテスト
ユーザー 後藤 響_Goto Toyomu
提出日時 2026-08-30 13:37:56
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 576µs
コード長 1,308 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,207 ms
コンパイル使用メモリ 352,340 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-30 13:38:57
合計ジャッジ時間 3,877 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

// 型定義
#define ull unsigned long long
#define ll long long
#define ul unsigned long
using P = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

// ループマクロ
#define FOR(i, l, r) for(size_t i = (l); i < (r); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; --i)
#define rfor(v, vec) for(auto &v : (vec))
#define itrloop(itr, begin, end) for(auto itr = (begin); itr != end; ++itr)
#define crfor(v, vec) for(const auto &v : (vec))

// イテレータマクロ
#define all(x) x.begin(), x.end()
#define call(x) x.cbegin(), x.cend()
#define rall(x) x.rbegin(), x.rend()

// 便利関数 (chmin / chmax)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// 定数
const ll INF = 1LL << 60; // 十分大きな値(約10^18)
#define el '\n'
void solve() {
ll N,X;

cin>>N>>X;
vl A(N);
ll sum=0;
rep(i,N){
cin>>A[i];
sum+=A[i];
}    
if(sum<=X){
cout<<0<<el;
}else{
    cout<<sum-X<<el;
}
}
// Generated by 3.0.1 https://github.com/kyuridenamida/atcoder-tools
int main(){

    cout << fixed << setprecision(15);
    solve();
    return 0;
}
0