結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー magstamagsta
提出日時 2021-10-04 15:07:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,248 bytes
コンパイル時間 9,960 ms
コンパイル使用メモリ 289,840 KB
実行使用メモリ 6,812 KB
最終ジャッジ日時 2024-04-16 13:45:18
合計ジャッジ時間 8,745 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main() {
    registerValidation();
	long long N, M;
	N = inf.readLong((long long)1, (long long)1000, "N");
	inf.readSpace();
	M = inf.readLong((long long)1, (long long)1000, "M");
	inf.readEoln();
	vector<long long> X(N), Y(M);
	for (int i = 0; i < N; i++) {
	    if (i != 0) inf.readSpace();
	    X[i] = inf.readLong((long long)1, (long long)1000000000, "X");
	}
	inf.readEoln();
	for (int i = 0; i < M; i++) {
	    if (i != 0) inf.readSpace();
	    Y[i] = inf.readLong((long long)1, (long long)1000000000, "Y");
	}
	inf.readEoln();
	inf.readEof();
	
	for (int i = 0; i < N; i++) {
	    for (int j = 0; j < N; j++) {
	        if (i != j && X[i] == X[j]) cout << -1 << endl;
	    }
	}
	for (int i = 0; i < M; i++) {
	    for (int j = 0; j < M; j++) {
	        if (i != j && Y[i] == Y[j]) cout << -1 << endl;
	    }
	}
	for (int i = 0; i < N; i++) {
	    for (int j = 0; j < M; j++) {
	        if (X[i] == Y[j]) cout << -1 << endl;
	    }
	}

	for (int i = 0; i < N; i++) {
		long long min_ = 1LL << 60;
		for (int j = 0; j < M; j++) {
			if (X[i] < Y[j]) min_ = min(min_, Y[j] - X[i]);
		}
		if (min_ != 1LL << 60) cout << min_ << endl;
		else cout << "Infinity" << endl;
	}
}
0