結果
問題 | No.110 しましまピラミッド |
ユーザー |
![]() |
提出日時 | 2017-08-24 10:35:07 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,135 bytes |
コンパイル時間 | 3,334 ms |
コンパイル使用メモリ | 65,536 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 03:00:12 |
合計ジャッジ時間 | 3,752 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 36) Warning: imported and not used: 'math' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math var wn = stdin.readline.parseInt W = stdin.readline.split.map(parseInt) bn = stdin.readline.parseInt B = stdin.readline.split.map(parseInt) cnt : int b,w : int ans : int B.sort(system.cmp) B.reverse W.sort(system.cmp) W.reverse for k in 0..1: var m : int t : int cnt : int = 1 if k == 0: m = B[0] b = 1 w = 0 t = 0 else: m = W[0] b = 0 w = 1 t = 1 var flag = true while flag: flag = false if t == 0: while w < wn: if W[w] < m: m = W[w] t = 1 flag = true cnt += 1 break else: w += 1 if t == 1: while b < bn: if B[b] < m: m = B[b] t = 0 flag = true cnt += 1 break else: b += 1 ans = max(ans, cnt) echo ans