提出 #16011444


ソースコード 拡げる

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

void solve() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if (a[i] != a[j] && a[i] != a[k] && a[j] != a[k] && a[i] + a[j] > a[k]) {
					ans++;
				}
			}
		}
	}

	cout << ans;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		cout << endl;
	}
}

提出情報

提出日時
問題 B - Making Triangle
ユーザ Zombie358
言語 C++ (GCC 9.2.1)
得点 200
コード長 767 Byte
結果 AC
実行時間 4 ms
メモリ 3584 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 4
AC × 23
セット名 テストケース
Sample s1.txt, s2.txt, s3.txt, s4.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, s1.txt, s2.txt, s3.txt, s4.txt
ケース名 結果 実行時間 メモリ
01.txt AC 3 ms 3480 KiB
02.txt AC 2 ms 3472 KiB
03.txt AC 4 ms 3520 KiB
04.txt AC 2 ms 3460 KiB
05.txt AC 2 ms 3580 KiB
06.txt AC 2 ms 3536 KiB
07.txt AC 2 ms 3428 KiB
08.txt AC 1 ms 3528 KiB
09.txt AC 2 ms 3424 KiB
10.txt AC 2 ms 3536 KiB
11.txt AC 2 ms 3480 KiB
12.txt AC 2 ms 3552 KiB
13.txt AC 2 ms 3484 KiB
14.txt AC 2 ms 3480 KiB
15.txt AC 2 ms 3580 KiB
16.txt AC 2 ms 3480 KiB
17.txt AC 2 ms 3528 KiB
18.txt AC 2 ms 3468 KiB
19.txt AC 2 ms 3584 KiB
s1.txt AC 3 ms 3472 KiB
s2.txt AC 2 ms 3472 KiB
s3.txt AC 2 ms 3532 KiB
s4.txt AC 2 ms 3420 KiB