Submission #00108
ソースコード
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 | #include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define ll long long #define next_per(v) next_permutation(v.begin(), v.end()) #define prev_per(v) prev_permutation(v.begin(), v.end()) #define fixed(v) fixed << setprecision(v) #define total(n) ((n) * ((n) + 1) / 2) #define combi(n) ((n) * ((n)-1) / 2) // n個の数の組み合わせ数 #define lcm(a, b) ((a) * (b) / __gcd(a, b)) // binery_search(all(v),key) = keyがあるかないかをboolで返す // lower_bound(all(v),key) = key以上のイテレーターを返す(一番左) // upper_bound(all(v),key) = keyより大きい要素のイテレーターを返す // 最小値=max_element(v.begin(),v.end()); // 最大値=min_element(v.begin(),v.end()); template < class x> x rng_total(x l, x r) { // l ~ rまでの数の総和 return ((l + r) * (r - l + 1) / 2); } template < class x> x rng_combi(x l, x r) { //「l個の物からr個取った組み合わせ数」 x ans = 1; l++; for (x i = 1; i <= r; i++) { x sub = l - i; ans *= sub; ans /= i; } return (ans); } template < class x> x dig_sum(x num) { // 各桁の総和 x ans = 0; while (num > 0) { ans += num % 10; num /= 10; } return (ans); } // [struct]-------------------------------------- // <UnionFind> struct UnionFind { // 親の要素とサイズを管理する変数 int group_cnt; vector< int > parent, size; // 変数の初期化 UnionFind( int n) { parent.resize(n, -1); size.resize(n, 1); group_cnt = n; } // x の根を求める int root( int x) { // x が根のとき if (parent[x] == -1) return x; // 経路圧縮 return parent[x] = root(parent[x]); } // x と y の根が同じか bool isSame( int x, int y) { return root(x) == root(y); } // x と y のグループを併合する bool unite( int x, int y) { // x と y の根を取得 int rootX = root(x); int rootY = root(y); // x と y が同じグループのときは何もしない if (rootX == rootY) return ( false ); // union by size( y のサイズが小さくなるように調整 ) if (size[rootX] < size[rootY]) swap(rootX, rootY); // y の親を x にする parent[rootY] = rootX; // 連結成分の個数を一つ減らす group_cnt--; // x のサイズに y のサイズを足す size[rootX] += size[rootY]; return ( true ); } }; //----------------------------------------------------- int main() { cin.tie(nullptr); ios_base::sync_with_stdio( false ); //----------------------------------------------------- int n; cin >> n; vector< int > d(n); for ( int i = 0; i < n; i++) { cin >> d[i]; d[i] /= 10; } int now = 0; for ( int i = 0; i < n; i++) { now--; now = max(now, d[i]); if (now < 1) { cout << "no" << endl; return (0); } } reverse(all(d)); now = 0; for ( int i = 0; i < n; i++) { now--; now = max(now, d[i]); if (now < 1) { cout << "no" << endl; return (0); } } cout << "yes" << endl; return (0); } // sishou |
ステータス
項目 | データ |
---|---|
問題 | 0006 - トランポリン |
ユーザー名 | ei2134 |
投稿日時 | 2023-07-31 10:52:55 |
言語 | C++17 |
状態 | Accepted |
得点 | 11 |
ソースコード長 | 3572 Byte |
最大実行時間 | 41 ms |
最大メモリ使用量 | 1936 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 11 / 11 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in1.txt | AC | 24 ms | 476 KB |
1
|
in2.txt | AC | 22 ms | 588 KB |
1
|
in3.txt | AC | 22 ms | 592 KB |
1
|
in4.txt | AC | 24 ms | 632 KB |
1
|
in5.txt | AC | 16 ms | 640 KB |
1
|
in6.txt | AC | 16 ms | 596 KB |
1
|
in7.txt | AC | 20 ms | 684 KB |
1
|
in8.txt | AC | 30 ms | 1796 KB |
1
|
in9.txt | AC | 30 ms | 1728 KB |
1
|
in10.txt | AC | 41 ms | 1708 KB |
1
|
in11.txt | AC | 19 ms | 488 KB |
1
|
in12.txt | AC | 21 ms | 440 KB |
1
|
in13.txt | AC | 20 ms | 392 KB |
1
|
in14.txt | AC | 27 ms | 600 KB |
1
|
in15.txt | AC | 18 ms | 556 KB |
1
|
in16.txt | AC | 32 ms | 516 KB |
1
|
in17.txt | AC | 17 ms | 472 KB |
1
|
in18.txt | AC | 15 ms | 556 KB |
1
|
in19.txt | AC | 17 ms | 508 KB |
1
|
in20.txt | AC | 19 ms | 540 KB |
1
|
in21.txt | AC | 21 ms | 496 KB |
1
|
in22.txt | AC | 15 ms | 576 KB |
1
|
in23.txt | AC | 19 ms | 532 KB |
1
|
in24.txt | AC | 20 ms | 484 KB |
1
|
in25.txt | AC | 19 ms | 568 KB |
1
|
in26.txt | AC | 21 ms | 648 KB |
1
|
in27.txt | AC | 19 ms | 604 KB |
1
|
in28.txt | AC | 20 ms | 644 KB |
1
|
in29.txt | AC | 16 ms | 552 KB |
1
|
in30.txt | AC | 18 ms | 676 KB |
1
|
in31.txt | AC | 27 ms | 972 KB |
1
|
in32.txt | AC | 40 ms | 1688 KB |
1
|
in33.txt | AC | 39 ms | 1752 KB |
1
|
in34.txt | AC | 35 ms | 1684 KB |
1
|
in35.txt | AC | 37 ms | 1872 KB |
1
|
in36.txt | AC | 41 ms | 1936 KB |
1
|
in37.txt | AC | 28 ms | 1868 KB |
1
|
in38.txt | AC | 34 ms | 1796 KB |
1
|
in39.txt | AC | 41 ms | 1856 KB |
1
|
in40.txt | AC | 28 ms | 1864 KB |
1
|