結果
問題 |
No.216 FAC
|
ユーザー |
![]() |
提出日時 | 2018-01-14 11:34:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 921 bytes |
コンパイル時間 | 726 ms |
コンパイル使用メモリ | 77,480 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-24 02:31:33 |
合計ジャッジ時間 | 1,699 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 3 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:29:9: warning: argument to variable-length array is too large [-Wvla-larger-than=] 29 | int T[ma] = {}; | ^ main.cpp:29:9: note: limit is 9223372036854775807 bytes, but argument is 18446744065119617024
ソースコード
#include <iostream> #include <math.h> #include <algorithm> #include <functional> #include <vector> #include <typeinfo> #include <climits> #include <ctype.h> #include <string> #include <stdio.h> using namespace std; #define INIT cin.tie(0); ios::sync_with_stdio(false); #define FOR(i, a, n) for (int i = a; i < n; i++) #define REP(i, n) for(int i = 0; i < n; i++) int main() { INIT; int n; cin >> n; int A[n], B[n]; REP(i, n) cin >> A[i]; int ma = INT_MIN; REP(i, n){ cin >> B[i]; ma = max(ma, B[i]); } int T[ma] = {}; int k = 0; REP(i, n){ if(B[i] == 0) k += A[i]; else T[B[i]] += A[i]; } int T_size = ma; ma = INT_MIN; int f = 0; REP(i, T_size){ if(k < T[i]){ cout << "NO" << endl; f = 1; break; } } if(f == 0) cout << "YES" << endl; return 0; }