結果
問題 | No.854 公平なりんご分配 |
ユーザー | leaf_1415 |
提出日時 | 2019-07-26 22:33:34 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,741 bytes |
コンパイル時間 | 721 ms |
コンパイル使用メモリ | 77,944 KB |
実行使用メモリ | 246,164 KB |
最終ジャッジ日時 | 2024-07-02 08:01:02 |
合計ジャッジ時間 | 14,277 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 12 ms
7,340 KB |
testcase_01 | AC | 11 ms
6,948 KB |
testcase_02 | AC | 11 ms
7,220 KB |
testcase_03 | AC | 11 ms
7,216 KB |
testcase_04 | AC | 12 ms
9,264 KB |
testcase_05 | AC | 12 ms
11,308 KB |
testcase_06 | AC | 11 ms
7,092 KB |
testcase_07 | AC | 12 ms
7,088 KB |
testcase_08 | AC | 11 ms
7,216 KB |
testcase_09 | AC | 12 ms
7,220 KB |
testcase_10 | AC | 12 ms
7,216 KB |
testcase_11 | AC | 11 ms
7,344 KB |
testcase_12 | AC | 13 ms
17,452 KB |
testcase_13 | AC | 12 ms
15,668 KB |
testcase_14 | AC | 12 ms
7,220 KB |
testcase_15 | AC | 12 ms
13,616 KB |
testcase_16 | AC | 14 ms
15,668 KB |
testcase_17 | AC | 14 ms
15,660 KB |
testcase_18 | AC | 14 ms
15,536 KB |
testcase_19 | AC | 14 ms
15,536 KB |
testcase_20 | AC | 13 ms
13,488 KB |
testcase_21 | AC | 14 ms
17,460 KB |
testcase_22 | AC | 33 ms
97,720 KB |
testcase_23 | AC | 33 ms
108,204 KB |
testcase_24 | AC | 41 ms
126,988 KB |
testcase_25 | AC | 33 ms
108,128 KB |
testcase_26 | AC | 38 ms
117,036 KB |
testcase_27 | AC | 37 ms
118,908 KB |
testcase_28 | AC | 29 ms
81,080 KB |
testcase_29 | AC | 29 ms
89,320 KB |
testcase_30 | AC | 32 ms
106,032 KB |
testcase_31 | AC | 38 ms
118,880 KB |
testcase_32 | AC | 84 ms
168,240 KB |
testcase_33 | AC | 95 ms
146,460 KB |
testcase_34 | AC | 144 ms
184,736 KB |
testcase_35 | AC | 108 ms
170,296 KB |
testcase_36 | AC | 91 ms
121,664 KB |
testcase_37 | AC | 84 ms
169,276 KB |
testcase_38 | AC | 72 ms
156,968 KB |
testcase_39 | AC | 201 ms
184,212 KB |
testcase_40 | AC | 104 ms
142,980 KB |
testcase_41 | AC | 111 ms
167,748 KB |
testcase_42 | AC | 129 ms
180,900 KB |
testcase_43 | AC | 159 ms
171,952 KB |
testcase_44 | AC | 157 ms
176,240 KB |
testcase_45 | AC | 164 ms
139,864 KB |
testcase_46 | AC | 199 ms
179,244 KB |
testcase_47 | AC | 95 ms
153,692 KB |
testcase_48 | AC | 123 ms
182,008 KB |
testcase_49 | AC | 113 ms
181,584 KB |
testcase_50 | AC | 81 ms
168,924 KB |
testcase_51 | AC | 193 ms
179,984 KB |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | WA | - |
testcase_83 | AC | 405 ms
242,720 KB |
testcase_84 | AC | 676 ms
245,996 KB |
testcase_85 | AC | 414 ms
127,172 KB |
testcase_86 | WA | - |
testcase_87 | WA | - |
testcase_88 | WA | - |
testcase_89 | WA | - |
testcase_90 | WA | - |
testcase_91 | WA | - |
testcase_92 | AC | 521 ms
244,956 KB |
testcase_93 | AC | 513 ms
242,776 KB |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:42:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=] 42 | scanf("%d", &n); | ~^ ~~ | | | | | long long int* | int* | %lld main.cpp:43:45: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=] 43 | for(int i = 1; i <= n; i++) scanf("%d", &a[i]); | ~^ ~~~~~ | | | | | long long int* | int* | %lld main.cpp:42:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 42 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:43:42: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 43 | for(int i = 1; i <= n; i++) scanf("%d", &a[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <stdio.h> #include <stdlib.h> #include <unordered_map> #define llint long long using namespace std; llint n, Q; llint a[100005]; int d[325][100005]; int sum[325][100005]; unordered_map<int, int> mp, fmp[2005]; bool prime[2005]; vector<llint> pvec; int main(void) { for(int i = 2; i < 55; i++){ if(prime[i]) continue; for(int j = 2*i; j < 2005; j+=i) prime[j] = true; } for(int i = 2; i < 2005; i++){ if(!prime[i]) pvec.push_back(i); } int m = pvec.size(); for(int i = 1; i < 2005; i++){ for(int j = 0; j < m; j++){ int t = i; while(t % pvec[j] == 0){ fmp[i][j]++; t /= pvec[j]; } } } scanf("%d", &n); for(int i = 1; i <= n; i++) scanf("%d", &a[i]); for(int i = 1; i <= n; i++){ for(auto it = fmp[a[i]].begin(); it != fmp[a[i]].end(); it++) d[it->first][i] = it->second; } for(int i = 0; i < m; i++){ for(int j = 1; j <= n; j++) sum[i][j] = sum[i][j-1] + d[i][j]; } for(int i = 1; i <= n; i++){ if(a[i] == 0) d[320][i] = 1; } for(int i = 1; i <= n; i++){ sum[320][i] = sum[320][i-1] + d[320][i]; } cin >> Q; int p, l, r; for(int q = 0; q < Q; q++){ cin >> p >> l >> r; if(sum[320][r]-sum[320][l-1] > 0){ printf("NO\n"); continue; } int t = p; mp.clear(); for(int i = 0; i < m; i++){ if(pvec[i] > t) break; while(t % pvec[i] == 0){ mp[i]++; t /= pvec[i]; } } if(t > 1){ printf("NO\n"); continue; } bool flag = true; for(auto it = mp.begin(); it != mp.end(); it++){ if(it->second > sum[it->first][r]-sum[it->first][l-1]){ flag = false; break; } } if(flag) printf("Yes\n"); else printf("NO\n"); } return 0; }