結果

問題 No.3654 Cup Ramen
コンテスト
ユーザー 後藤 響_Goto Toyomu
提出日時 2026-08-30 13:35:17
言語 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
結果
RE  
実行時間 -
コード長 1,305 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,225 ms
コンパイル使用メモリ 351,956 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-08-30 13:36:14
合計ジャッジ時間 5,460 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void solve()':
main.cpp:34:7: warning: 'N' is used uninitialized [-Wuninitialized]
   34 | vl A(N);
      |       ^
main.cpp:33:4: note: 'N' declared here
   33 | ll N,X;
      |    ^
main.cpp:39:4: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized]
   39 | sum+=A[i];
main.cpp:36:4: note: 'sum' was declared here
   36 | ll sum;
      |    ^~~

ソースコード

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

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