結果

問題 No.914 Omiyage
ユーザー beet
提出日時 2019-10-25 21:21:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 2,446 ms
コンパイル使用メモリ 193,924 KB
最終ジャッジ日時 2025-01-08 01:01:57
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 10 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  Int n,m,k;
  cin>>n>>m>>k;
  Int res=0;
  for(Int i=0;i<n;i++){
    vector<Int> as(m);
    for(Int j=0;j<m;j++) cin>>as[j];
    res+=*max_element(as.begin(),as.end());
  }
  if(res>k) drop(-1);
  drop(k-res);
  return 0;
}
0