Submission #61091
ソースコード
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 | #include<iostream> #include<algorithm> #include<vector> #include<string> #include<cmath> #include<queue> #include<stack> #include<map> #include<numeric> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) template < typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true ); } template < typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true ); } int main () { cin.tie(0); ios::sync_with_stdio( false ); int n,q; cin >> n >> q; vector< int > a(n),b(q); for ( int i = 0; i < n; i++){ cin >> a[i]; } for ( int i = 0; i < q; i++){ cin >> b[i]; } for ( int i = 0; i < q; i++){ int l = -1,r = n; while (r - l > 1){ int mid = (r + l) / 2; if (a[mid] < b[i]){ l = mid; } else { r = mid; } } if (r != n && a[r] == b[i]){ cout << "Yes\n" ; } else { cout << "No\n" ; } } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0943 - 値をさがせ |
ユーザー名 | kumakuma |
投稿日時 | 2020-07-18 08:22:12 |
言語 | C++14 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 1001 Byte |
最大実行時間 | 425 ms |
最大メモリ使用量 | 228896 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 6 / 6 | * |
2 | NQ_small | 2 / 2 | *S? |
3 | a_small_positive | 2 / 2 | *?S |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||
---|---|---|---|---|---|---|
input-sample1_SS | AC | 43 ms | 604 KB |
1
|
2
|
3
|
input-sample2_SB | AC | 22 ms | 560 KB |
1
|
2
|
|
input01_SS | AC | 25 ms | 388 KB |
1
|
2
|
3
|
input02_SS | AC | 34 ms | 468 KB |
1
|
2
|
3
|
input03_SS | AC | 21 ms | 540 KB |
1
|
2
|
3
|
input04_SS | AC | 24 ms | 488 KB |
1
|
2
|
3
|
input05_SS | AC | 21 ms | 560 KB |
1
|
2
|
3
|
input06_SB | AC | 28 ms | 636 KB |
1
|
2
|
|
input07_SB | AC | 23 ms | 704 KB |
1
|
2
|
|
input08_SB | AC | 28 ms | 644 KB |
1
|
2
|
|
input09_SB | AC | 22 ms | 584 KB |
1
|
2
|
|
input10_SB | AC | 20 ms | 664 KB |
1
|
2
|
|
input11_BS | AC | 119 ms | 7516 KB |
1
|
3
|
|
input12_BS | AC | 295 ms | 36424 KB |
1
|
3
|
|
input13_BS | AC | 236 ms | 55676 KB |
1
|
3
|
|
input14_BS | AC | 102 ms | 52448 KB |
1
|
3
|
|
input15_BS | AC | 145 ms | 62584 KB |
1
|
3
|
|
input16_BB | AC | 94 ms | 62804 KB |
1
|
||
input17_BB | AC | 201 ms | 82652 KB |
1
|
||
input18_BB | AC | 107 ms | 88900 KB |
1
|
||
input19_BB | AC | 201 ms | 88888 KB |
1
|
||
input20_BB | AC | 127 ms | 103256 KB |
1
|
||
input21_BB | AC | 321 ms | 142892 KB |
1
|
||
input22_BB | AC | 425 ms | 179500 KB |
1
|
||
input23_BS | AC | 274 ms | 204196 KB |
1
|
3
|
|
input24_BB | AC | 295 ms | 228896 KB |
1
|