Submission #40981
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | import java.io.*; import java.util.*; import java.lang.*; import java.math.*; import java.text.*; class Main{ private static final InputStream in = System.in; static final PrintWriter out = new PrintWriter(System.out); public static void main(String args[]){ int [] d = new int [300100]; int n = fgetInt(); for ( int i = 0; i < n; i++ ) { d[i] = fgetInt(); } int tmp = 10; boolean flg = true ; for ( int i = 0; i < n && flg; i++ ) { tmp -= 10; if ( tmp < 0 ) { flg = false ; } else { tmp = Math.max(tmp, d[i]); } } for ( int i = n-1; i != -1 && flg; i-- ) { tmp -= 10; if ( tmp < 0 ) { flg = false ; } else { tmp = Math.max(tmp, d[i]); } } iprint(flg ? "yes" : "no" ); ifin(); } static String fgetStr(){ return next(); } static String fgetLine(){ return nextLine(); } static char fgetChar(){ return fgetStr().charAt(0); } static int fgetInt(){ return nextInt(); } static long fgetLong(){ return nextLong(); } static double fgetDouble(){ return nextDouble(); } static BigInteger getBig(){ return new BigInteger(fgetStr()); } static String reverseStr(String str){ StringBuffer sb = new StringBuffer(str); return sb.reverse().toString(); } static int [] getIntArray( int length){ int [] array = new int [length]; int i; for ( i = 0; i < length; i++ ) { array[i] = fgetInt(); } return array; } static int [][] getIntMap( int h, int w) { int [][] map = new int [h][w]; int i; for ( i = 0; i < h; i++ ) { map[i] = getIntArray(w); } return map; } static void iprintIntArray( int [] object) { int length = object.length; int i; iprintf(object[0]); for ( i = 1; i < length; i++ ) iprintf( " " + object[i]); iprint( "" ); } static void iprintIntMap( int [][] object) { int length = object.length; int i; for ( i = 0; i < length; i++ ) iprintIntArray(object[i]); } static void iprint(Object a){ out.println(a); } static void iprintf(Object a){ out.print(a); } static void ifin(){ out.flush(); } static long kaijou ( int n) { int a = 1; int i; for ( i = 2; i <= n; i++ ) { a *= i; } return a; } static int upperBound( int [] a, int n, int val){ int low = 0; int hi = n; while ( low < hi ) { int mid = (low+hi) / 2; if ( a[mid] <= val ) low = mid + 1; else hi = mid; } return low; } static int lowerBound( int [] a, int n, int val){ int low = 0; int hi = n; while ( low < hi ) { int mid = (low+hi) / 2; if ( a[mid] < val ) low = mid + 1; else hi = mid; } return low; } static boolean contains( int [] a, int n, int val){ int low = 0; int hi = n; while ( low < hi ) { int mid = (low+hi)/2; if ( a[mid] == val ) return true ; else if ( a[mid] < val ) low = mid+1; else hi = mid; } return false ; } private static final byte[] buffer = new byte[1024]; private static int ptr = 0; private static int buflen = 0; private static 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 static int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar( int c) { return 33 <= c && c <= 126; } public static boolean hasNext() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte(); } public static 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 static String nextLine() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b) || b == 32) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public static 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 static int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return ( int ) nl; } public static double nextDouble() { return Double.parseDouble(next()); } } |
ステータス
項目 | データ |
---|---|
問題 | 0960 - トランポリン |
ユーザー名 | r1825 |
投稿日時 | 2018-08-09 11:37:40 |
言語 | Java |
状態 | Accepted |
得点 | 11 |
ソースコード長 | 6303 Byte |
最大実行時間 | 100 ms |
最大メモリ使用量 | 16100 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 11 / 11 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in1.txt | AC | 78 ms | 13996 KB |
1
|
in2.txt | AC | 77 ms | 14928 KB |
1
|
in3.txt | AC | 76 ms | 15676 KB |
1
|
in4.txt | AC | 74 ms | 14716 KB |
1
|
in5.txt | AC | 78 ms | 15568 KB |
1
|
in6.txt | AC | 75 ms | 15228 KB |
1
|
in7.txt | AC | 73 ms | 15564 KB |
1
|
in8.txt | AC | 83 ms | 14916 KB |
1
|
in9.txt | AC | 77 ms | 15796 KB |
1
|
in10.txt | AC | 93 ms | 15628 KB |
1
|
in11.txt | AC | 89 ms | 15668 KB |
1
|
in12.txt | AC | 74 ms | 14916 KB |
1
|
in13.txt | AC | 73 ms | 15820 KB |
1
|
in14.txt | AC | 71 ms | 15560 KB |
1
|
in15.txt | AC | 72 ms | 13868 KB |
1
|
in16.txt | AC | 68 ms | 15700 KB |
1
|
in17.txt | AC | 83 ms | 15640 KB |
1
|
in18.txt | AC | 80 ms | 14288 KB |
1
|
in19.txt | AC | 71 ms | 14616 KB |
1
|
in20.txt | AC | 91 ms | 14048 KB |
1
|
in21.txt | AC | 84 ms | 15524 KB |
1
|
in22.txt | AC | 74 ms | 15708 KB |
1
|
in23.txt | AC | 76 ms | 14052 KB |
1
|
in24.txt | AC | 75 ms | 15216 KB |
1
|
in25.txt | AC | 77 ms | 15636 KB |
1
|
in26.txt | AC | 74 ms | 15160 KB |
1
|
in27.txt | AC | 77 ms | 15648 KB |
1
|
in28.txt | AC | 71 ms | 14684 KB |
1
|
in29.txt | AC | 78 ms | 15664 KB |
1
|
in30.txt | AC | 74 ms | 14548 KB |
1
|
in31.txt | AC | 83 ms | 15656 KB |
1
|
in32.txt | AC | 100 ms | 14688 KB |
1
|
in33.txt | AC | 92 ms | 14344 KB |
1
|
in34.txt | AC | 87 ms | 15888 KB |
1
|
in35.txt | AC | 81 ms | 14244 KB |
1
|
in36.txt | AC | 85 ms | 13804 KB |
1
|
in37.txt | AC | 93 ms | 15940 KB |
1
|
in38.txt | AC | 81 ms | 14588 KB |
1
|
in39.txt | AC | 80 ms | 15072 KB |
1
|
in40.txt | AC | 86 ms | 16100 KB |
1
|