Submission #00021
ソースコード
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 | #include <iostream> #include <algorithm> #include <functional> using namespace std; using ll = long long ; ll h, w; ll a[1005]; ll b[1005]; bool check(ll w, ll h, ll a[], ll b[]) { ll aa[1005] = {}; ll bb[1005] = {}; for ( int j = 0; j < h; j++) { for ( int i = 0; i < w; i++) { if (b[j] - bb[j] > 0 && a[i] - aa[i] > 0) { aa[i]++; bb[j]++; } } } for ( int j = 0; j < h; j++) { if (b[j] != bb[j]) return false ; } for ( int i = 0; i < w; i++) { if (a[i] != aa[i]) return false ; } return true ; } int main() { cin >> w >> h; for ( int i = 0; i < w; i++) { cin >> a[i]; } for ( int j = 0; j < h; j++) { cin >> b[j]; } sort(a, a + w, greater<ll>()); sort(b, b + h, greater<ll>()); if (check(w, h, a, b) || check(h, w, b, a)) { cout << 1 << endl; } else { cout << 0 << endl; } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0005 - 宝の地図 |
ユーザー名 | ARUMAKAN |
投稿日時 | 2019-10-23 18:55:34 |
言語 | C++14 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 890 Byte |
最大実行時間 | 31 ms |
最大メモリ使用量 | 828 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 8 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 31 ms | 604 KB |
1
|
in02.txt | AC | 27 ms | 560 KB |
1
|
in03.txt | AC | 20 ms | 644 KB |
1
|
in04.txt | AC | 19 ms | 472 KB |
1
|
in05.txt | AC | 15 ms | 552 KB |
1
|
in06.txt | AC | 18 ms | 508 KB |
1
|
in07.txt | AC | 20 ms | 468 KB |
1
|
in08.txt | AC | 24 ms | 552 KB |
1
|
in09.txt | AC | 20 ms | 640 KB |
1
|
in10.txt | AC | 19 ms | 596 KB |
1
|
in11.txt | AC | 20 ms | 548 KB |
1
|
in12.txt | AC | 18 ms | 632 KB |
1
|
in13.txt | AC | 24 ms | 588 KB |
1
|
in14.txt | AC | 23 ms | 544 KB |
1
|
in15.txt | AC | 24 ms | 624 KB |
1
|
in16.txt | AC | 27 ms | 708 KB |
1
|
in17.txt | AC | 27 ms | 536 KB |
1
|
in18.txt | AC | 21 ms | 488 KB |
1
|
in19.txt | AC | 26 ms | 572 KB |
1
|
in20.txt | AC | 26 ms | 528 KB |
1
|
in21.txt | AC | 22 ms | 480 KB |
1
|
in22.txt | AC | 19 ms | 568 KB |
1
|
in23.txt | AC | 18 ms | 648 KB |
1
|
in24.txt | AC | 25 ms | 608 KB |
1
|
in25.txt | AC | 24 ms | 556 KB |
1
|
in26.txt | AC | 20 ms | 512 KB |
1
|
in27.txt | AC | 19 ms | 716 KB |
1
|
in28.txt | AC | 20 ms | 672 KB |
1
|
in29.txt | AC | 21 ms | 632 KB |
1
|
in30.txt | AC | 17 ms | 716 KB |
1
|
in31.txt | AC | 17 ms | 540 KB |
1
|
in32.txt | AC | 22 ms | 488 KB |
1
|
in33.txt | AC | 17 ms | 564 KB |
1
|
in34.txt | AC | 21 ms | 512 KB |
1
|
in35.txt | AC | 23 ms | 596 KB |
1
|
in36.txt | AC | 22 ms | 676 KB |
1
|
in37.txt | AC | 21 ms | 756 KB |
1
|
in38.txt | AC | 20 ms | 588 KB |
1
|
in39.txt | AC | 20 ms | 668 KB |
1
|
in40.txt | WA | 17 ms | 752 KB |
1
|
in41.txt | WA | 24 ms | 828 KB |
1
|
in42.txt | AC | 17 ms | 776 KB |
1
|
in43.txt | AC | 22 ms | 728 KB |
1
|
in44.txt | AC | 22 ms | 672 KB |
1
|
in45.txt | AC | 27 ms | 748 KB |
1
|
in46.txt | AC | 26 ms | 820 KB |
1
|