結果

問題 No.43 野球の試合
コンテスト
ユーザー tatt61880
提出日時 2021-04-03 12:42:12
言語 Kuin
(KuinC++ v.2021.9.17)
コンパイル:
kuinc -i _filename_ -o out.cpp -s /kuin/sys/ -e cpp -r -q
実行:
./a.out
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 805 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,590 ms
コンパイル使用メモリ 166,776 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-05 17:27:34
合計ジャッジ時間 2,146 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
out.cpp:676:14: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'std::shared_ptr<Array_<char16_t>>' [-Wnontrivial-memcall]
  676 |                         memset(r->B, 0, sizeof(T) * static_cast<std::size_t>(h + bufLen_<T>()));
      |                                   ^
out.cpp:688:9: note: in instantiation of function template specialization 'newArraysRec_<std::shared_ptr<Array_<std::shared_ptr<Array_<char16_t>>>>>::operator()<long>' requested here
  688 |         return newArraysRec_<T>()(std::forward<A>(a)...);
      |                ^
out.cpp:1629:11: note: in instantiation of function template specialization 'newArrays_<std::shared_ptr<Array_<std::shared_ptr<Array_<char16_t>>>>, long>' requested here
 1629 | (k_ao) = (newArrays_<type_(Array_<type_(Array_<char16_t>)>)>((k_am)));
      |           ^
out.cpp:676:14: note: explicitly cast the pointer to silence this warning
  676 |                         memset(r->B, 0, sizeof(T) * static_cast<std::size_t>(h + bufLen_<T>()));
      |                                   ^
      |                                (void*)
1 warning generated.

ソースコード

diff #
raw source code

func main()
	var n: int :: cui@inputInt()
	var s: [][]char :: #[n][]char
	for i(0, n - 1)
		do s[i] :: cui@input()
	end for
	
	var ans: int :: n
	var num: int :: n * (n - 1) / 2
	for ii(0, 2 ^ num - 1)
		var id: int :: ii
		var cnt: []int :: #[n]int
		for i(0, n - 1)
			for j(i + 1, n - 1)
				var result: char :: "ox"[id % 2]
				do id :/ 2
				if(s[i][j] <> '-' & s[i][j] <> result)
					skip ii
				end if
				if(result = 'o')
					do cnt[i] :+ 1
				else
					do cnt[j] :+ 1
				end if
			end for
		end for
		var cnt0: int :: cnt[0]
		do cnt.sort()
		do cnt.reverse()
		var rank: int :: 1
		for i(0, n - 1)
			if(i <> 0 & cnt[i] <> cnt[i - 1])
				do rank :+ 1
			end if
			if(cnt[i] = cnt0)
				do ans :: [ans, rank].min()
				break i
			end if
		end for
	end for
	do cui@print("\{ans}\n")
end func
0