結果

問題 No.914 Omiyage
ユーザー ningenMeningenMe
提出日時 2019-10-19 15:04:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 592 bytes
コンパイル時間 1,937 ms
コンパイル使用メモリ 173,032 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-09 11:45:24
合計ジャッジ時間 4,739 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 AC 1 ms
4,376 KB
testcase_20 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	//入力
	int N,M,K; cin >> N >> M >> K;
	assert(1<=N&&N<=20);
	assert(1<=M&&M<=20);
	assert(1<=K&&K<=1000);

	vector<vector<int>> a(N,vector<int>(M));
	for(int i = 0; i < N; ++i) {
		for(int j = 0; j < M; ++j) {
			cin >> a[i][j];
			assert(1 <= a[i][j] && a[i][j] <= 20);
		}
	}

	//ソート、差分計算、初期値
	int sum = 0;
	for(int i = 0; i < N; ++i) {
		sort(a[i].begin(),a[i].end());
		int ini = a[i][0];
		sum += ini;
		for(int j = 0; j < M; ++j) a[i][j] -= ini;
	}
	cout << max(K-sum,-1) << endl;

    return 0;
}
0