結果

問題 No.1994 Confusing Name
ユーザー atjh16atjh16
提出日時 2022-07-23 10:17:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 595 bytes
コンパイル時間 2,299 ms
コンパイル使用メモリ 199,076 KB
実行使用メモリ 9,776 KB
最終ジャッジ日時 2023-09-18 04:25:41
合計ジャッジ時間 7,159 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,244 KB
testcase_01 AC 2 ms
5,200 KB
testcase_02 AC 3 ms
4,956 KB
testcase_03 AC 2 ms
4,912 KB
testcase_04 AC 2 ms
4,960 KB
testcase_05 AC 3 ms
4,924 KB
testcase_06 AC 6 ms
4,972 KB
testcase_07 AC 3 ms
4,972 KB
testcase_08 AC 5 ms
4,920 KB
testcase_09 AC 6 ms
5,044 KB
testcase_10 AC 4 ms
5,016 KB
testcase_11 AC 3 ms
5,212 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int n, m, k;
string s[50000];
int a[500000];
bool f, g;

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}

	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			m = s[i].size(), k = s[j].size();

			if (m == k) {
				f = 1;
				g = 0;

				for (int u = 0; u < m; u++) {
					if (s[i][u] != s[j][u]) {
						if (!g)
							g = 1;
						else {
							f = 0;
							break;
						}
					}
				}

				if (f) {
					a[i]++;
					a[j]++;
				}
			}
		}
	}

	for(int i = 0; i < n; i++)
		cout << a[i] << endl;
}
0