結果

問題 No.2820 Non-Preferred IUPAC Nomenclature
ユーザー maguroflymagurofly
提出日時 2024-07-26 22:14:22
言語 Rust
(1.77.0)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 13,502 ms
コンパイル使用メモリ 390,192 KB
実行使用メモリ 77,560 KB
最終ジャッジ日時 2024-07-26 22:14:42
合計ジャッジ時間 19,362 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 1 ms
6,812 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 181 ms
77,560 KB
testcase_05 AC 89 ms
40,684 KB
testcase_06 AC 155 ms
67,804 KB
testcase_07 AC 17 ms
9,472 KB
testcase_08 AC 9 ms
6,944 KB
testcase_09 AC 13 ms
7,808 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 1 ms
6,944 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 1 ms
6,944 KB
testcase_21 AC 1 ms
6,944 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `N` should have a snake case name
 --> src/main.rs:4:3
  |
4 |         N: usize,
  |         ^ help: convert the identifier to snake case: `n`
  |
  = note: `#[warn(non_snake_case)]` on by default

ソースコード

diff #

use proconio::input;
fn main() {
	input! {
		N: usize,
		edges: [[String; 4]; N],
	}
	
	let mut graph = vec![vec![]; N];
	for i in 0 .. N {
		for x in &edges[i] {
			if x != "H" {
				graph[i].push(x.parse::<usize>().unwrap() - 1);
			}
		}
	}
	
	fn dfs(graph: &[Vec<usize>], u: usize, p: usize, ans: &mut String) {
		for &v in &graph[u] {
			if v != p {
				ans.push('(');
				dfs(graph, v, u, ans);
				ans.push_str("yl)");
			}
		}
		ans.push_str("meth");
	}
	let mut ans = String::new();
	dfs(&graph, 0, 0, &mut ans);
	ans.push_str("ane");
	println!("{}", ans);
}
0