結果
問題 | No.241 出席番号(1) |
ユーザー |
![]() |
提出日時 | 2018-08-25 02:33:26 |
言語 | D (dmd 2.109.1) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,531 bytes |
コンパイル時間 | 63 ms |
コンパイル使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-11-14 20:35:53 |
合計ジャッジ時間 | 441 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Main.d(1): Error: unable to read module `all` Main.d(1): Expected 'std/experimental/all.d' or 'std/experimental/all/package.d' in one of the following import paths: import path[0] = /opt/dmd/src/druntime/import/ import path[1] = /opt/dmd/src/phobos import path[2] = /home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd
ソースコード
import std.experimental.all;T read(T)() { return readln.chomp.to!T; }T[] reads(T)() { return readln.split.to!(T[]); }alias readint = read!int;alias readints = reads!int;void maxBipartiteMatching(bool[][] g) {bool mbm(int p, int[] left, int[] right, bool[][] g, bool[] used) {for (int i = 0; i < right.length; i++) {if (g[p][i] && right[i] == -1) {left[p] = i;right[i] = p;return true;}}for (int i = 0; i < right.length; i++) {if (g[p][i] && !used[i]) {used[i] = true;if (mbm(right[i], left, right, g, used)) {left[p] = i;right[i] = p;return true;}}}return false;}auto left = new int[g.length];auto right = new int[g[0].length];left[] = -1;right[] = -1;int cnt = 0;for (int i = 0; i < left.length; i++) {auto used = new bool[left.length];if (mbm(i, left, right, g, used)) {cnt++;}}if (cnt == left.length) {foreach (x; left) {writeln(x);}}else writeln(-1);}void main() {int n = readint;int[] a;for (int i = 0; i < n; i++) {a ~= readint;}auto g = new bool[][](n, n);for (int i = 0; i < n; i++) {g[i][] = true;g[i][a[i]] = false;}maxBipartiteMatching(g);}