結果
問題 | No.466 ジオラマ |
ユーザー | 37zigen |
提出日時 | 2020-04-18 08:39:35 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 170 ms / 2,000 ms |
コード長 | 3,764 bytes |
コンパイル時間 | 2,745 ms |
コンパイル使用メモリ | 82,872 KB |
実行使用メモリ | 41,612 KB |
最終ジャッジ日時 | 2024-10-03 22:53:03 |
合計ジャッジ時間 | 16,111 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 87 ms
39,644 KB |
testcase_01 | AC | 52 ms
36,828 KB |
testcase_02 | AC | 92 ms
39,892 KB |
testcase_03 | AC | 91 ms
39,868 KB |
testcase_04 | AC | 90 ms
39,524 KB |
testcase_05 | AC | 51 ms
36,812 KB |
testcase_06 | AC | 166 ms
40,960 KB |
testcase_07 | AC | 147 ms
40,812 KB |
testcase_08 | AC | 164 ms
41,060 KB |
testcase_09 | AC | 165 ms
41,120 KB |
testcase_10 | AC | 158 ms
41,204 KB |
testcase_11 | AC | 160 ms
40,864 KB |
testcase_12 | AC | 167 ms
41,080 KB |
testcase_13 | AC | 143 ms
40,868 KB |
testcase_14 | AC | 150 ms
40,572 KB |
testcase_15 | AC | 162 ms
41,124 KB |
testcase_16 | AC | 98 ms
39,756 KB |
testcase_17 | AC | 154 ms
40,924 KB |
testcase_18 | AC | 145 ms
40,908 KB |
testcase_19 | AC | 153 ms
40,808 KB |
testcase_20 | AC | 151 ms
41,068 KB |
testcase_21 | AC | 149 ms
40,800 KB |
testcase_22 | AC | 157 ms
40,832 KB |
testcase_23 | AC | 153 ms
40,828 KB |
testcase_24 | AC | 159 ms
40,960 KB |
testcase_25 | AC | 165 ms
41,080 KB |
testcase_26 | AC | 161 ms
41,124 KB |
testcase_27 | AC | 163 ms
41,412 KB |
testcase_28 | AC | 163 ms
41,092 KB |
testcase_29 | AC | 162 ms
41,308 KB |
testcase_30 | AC | 157 ms
41,024 KB |
testcase_31 | AC | 160 ms
41,020 KB |
testcase_32 | AC | 151 ms
40,612 KB |
testcase_33 | AC | 161 ms
40,548 KB |
testcase_34 | AC | 160 ms
41,200 KB |
testcase_35 | AC | 146 ms
41,064 KB |
testcase_36 | AC | 149 ms
40,532 KB |
testcase_37 | AC | 52 ms
36,800 KB |
testcase_38 | AC | 142 ms
41,132 KB |
testcase_39 | AC | 51 ms
36,816 KB |
testcase_40 | AC | 163 ms
40,932 KB |
testcase_41 | AC | 52 ms
36,712 KB |
testcase_42 | AC | 160 ms
41,124 KB |
testcase_43 | AC | 51 ms
36,692 KB |
testcase_44 | AC | 153 ms
40,940 KB |
testcase_45 | AC | 49 ms
36,700 KB |
testcase_46 | AC | 142 ms
40,736 KB |
testcase_47 | AC | 52 ms
36,348 KB |
testcase_48 | AC | 154 ms
41,096 KB |
testcase_49 | AC | 51 ms
36,956 KB |
testcase_50 | AC | 144 ms
40,688 KB |
testcase_51 | AC | 51 ms
36,736 KB |
testcase_52 | AC | 156 ms
41,068 KB |
testcase_53 | AC | 51 ms
36,456 KB |
testcase_54 | AC | 150 ms
40,680 KB |
testcase_55 | AC | 51 ms
36,724 KB |
testcase_56 | AC | 117 ms
38,652 KB |
testcase_57 | AC | 52 ms
36,708 KB |
testcase_58 | AC | 94 ms
38,376 KB |
testcase_59 | AC | 51 ms
36,324 KB |
testcase_60 | AC | 133 ms
40,664 KB |
testcase_61 | AC | 52 ms
36,688 KB |
testcase_62 | AC | 125 ms
40,148 KB |
testcase_63 | AC | 51 ms
36,744 KB |
testcase_64 | AC | 102 ms
40,008 KB |
testcase_65 | AC | 51 ms
36,640 KB |
testcase_66 | AC | 158 ms
41,032 KB |
testcase_67 | AC | 52 ms
36,424 KB |
testcase_68 | AC | 144 ms
40,672 KB |
testcase_69 | AC | 52 ms
36,924 KB |
testcase_70 | AC | 155 ms
40,832 KB |
testcase_71 | AC | 51 ms
36,480 KB |
testcase_72 | AC | 149 ms
40,812 KB |
testcase_73 | AC | 51 ms
36,724 KB |
testcase_74 | AC | 161 ms
41,280 KB |
testcase_75 | AC | 51 ms
36,980 KB |
testcase_76 | AC | 53 ms
36,680 KB |
testcase_77 | AC | 53 ms
36,596 KB |
testcase_78 | AC | 52 ms
36,708 KB |
testcase_79 | AC | 53 ms
36,632 KB |
testcase_80 | AC | 53 ms
36,748 KB |
testcase_81 | AC | 91 ms
38,104 KB |
testcase_82 | AC | 51 ms
36,832 KB |
testcase_83 | AC | 75 ms
37,752 KB |
testcase_84 | AC | 145 ms
41,168 KB |
testcase_85 | AC | 170 ms
41,612 KB |
testcase_86 | AC | 79 ms
39,412 KB |
ソースコード
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { new Main().run(); } void run() { FastScanner sc=new FastScanner(); PrintWriter pw=new PrintWriter(System.out); int A=sc.nextInt(); int B=sc.nextInt(); int C=sc.nextInt(); int D=sc.nextInt(); if (A==C&&B==C) { int N=C; int M=C; if (D<C||N==1) { System.out.println(-1); } else { System.out.println(N+" "+M); for (int i=0;i<C;++i) { pw.println(i+" "+(i+1)%C); } } } else if (A==C) { int d=B-C; int N=C+d; int M=N-1; if (D<M) { System.out.println(-1); } else { System.out.println(N+" "+M); System.out.println(1+" "+0); int p=2; for (int i=0;i<d-1;++i) pw.println(1+" "+(p++)); for (int i=0;i<C-1;++i) pw.println(0+" "+(p++)); } } else if (B==C) { int d=A-C; int N=C+d; int M=N-1; if (D<M) { System.out.println(-1); } else { System.out.println(N+" "+M); System.out.println(0+" "+1); int p=2; for (int i=0;i<d-1;++i) pw.println(0+" "+(p++)); for (int i=0;i<C-1;++i) pw.println(1+" "+(p++)); } } else { int N=(A-C)+(B-C)+C; int M=(C==0?A-1+B-1:(A-C)+(B-C)+C-1); if (D<M) { System.out.println(-1); } else { System.out.println(N+" "+M); int p=2; for (int i=0;i<A-C-1;++i) pw.println(0+" "+(p++)); for (int i=0;i<B-C-1;++i) pw.println(1+" "+(p++)); if (C>0) { pw.println(0+" "+p); pw.println(1+" "+p); int ab=p++; for (int i=0;i<C-1;++i) { pw.println(ab+" "+(p++)); } } } } pw.close(); } void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));} } class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; }else{ ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;} private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;} private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;} public boolean hasNext() { skipUnprintable(); return hasNextByte();} public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while(isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while(true){ if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; }else if(b == -1 || !isPrintableChar(b)){ return minus ? -n : n; }else{ throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { return (int)nextLong(); } }