結果
問題 | No.216 FAC |
ユーザー | はまやんはまやん |
提出日時 | 2016-06-12 01:53:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 488 bytes |
コンパイル時間 | 1,560 ms |
コンパイル使用メモリ | 175,652 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 00:59:12 |
合計ジャッジ時間 | 2,522 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:28:17: warning: 'Kkun' may be used uninitialized [-Wmaybe-uninitialized] 28 | if (other <= Kkun) | ^~ main.cpp:19:21: note: 'Kkun' was declared here 19 | int Kkun, other = 0; | ^~~~
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) int N; int A[100], B[100]; int main() { while (cin >> N) { rep(i, 0, N) cin >> A[i]; rep(i, 0, N) cin >> B[i]; map<int, int> m; m[0] = 0; rep(i, 0, N) m[B[i]] += A[i]; int Kkun, other = 0; for (auto p : m) { if (p.first == 0) Kkun = p.second; else other = max(other, p.second); } if (other <= Kkun) cout << "YES" << endl; else cout << "NO" << endl; } }