結果

問題 No.706 多眼生物の調査
ユーザー d_seid_sei
提出日時 2019-09-08 10:23:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,076 bytes
コンパイル時間 850 ms
コンパイル使用メモリ 88,556 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-09 22:23:12
合計ジャッジ時間 1,932 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include <vector>
#include<cmath>
#include<iomanip>
#include<queue>
using namespace std;
typedef long long int lint;
int main() {
	int N;
	cin >> N;
	if (N > 1) {
		vector<string>veca(N);
		for (int ia = 0; ia < N; ia++) {
			cin >> veca.at(ia);
		}
		vector<int>vecb(N + 1);
		int cnt = 0;
		for (int ib = 0; ib < N; ib++) {
			for (int ic = 0; ic < veca.at(ib).size(); ic++) {
				if (veca.at(ib).at(ic) == '^') {
					cnt++;
				}
			}
			vecb.at(ib) = cnt;
			cnt = 0;
		}
		sort(vecb.begin(), vecb.end());
		reverse(vecb.begin(), vecb.end());
		int J = 0;
		int j = 1;
		for (int id = 0; id < N; id++) {
			if (vecb.at(id) == vecb.at(id + 1)) {
				j++;
			}
			else {
				J = max(J, j);
				j = 1;
			}
		}
		int cntb = 1;
		int i = 0;
		while (cntb != J) {
			if (vecb.at(i) == vecb.at(i + 1)) {
				cntb++;
			}
			i++;
		}
		cout << vecb.at(i - 1) << endl;
	}
	else {
		int ans = 0;
		string S;
		cin >> S;
		for (int ig = 0; ig < S.size(); ig++) {
			if (S.at(ig) == '^') {
				ans++;
			}
		}
		cout << ans << endl;
	}
}



	
0