結果
問題 | No.854 公平なりんご分配 |
ユーザー | tarattata1 |
提出日時 | 2019-07-27 09:59:20 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,500 bytes |
コンパイル時間 | 1,261 ms |
コンパイル使用メモリ | 81,404 KB |
実行使用メモリ | 39,772 KB |
最終ジャッジ日時 | 2023-09-15 05:56:21 |
合計ジャッジ時間 | 9,018 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
8,772 KB |
testcase_01 | AC | 1 ms
4,384 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,384 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,384 KB |
testcase_09 | AC | 1 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,384 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 1 ms
4,384 KB |
testcase_13 | AC | 2 ms
4,380 KB |
testcase_14 | AC | 2 ms
4,384 KB |
testcase_15 | AC | 1 ms
4,384 KB |
testcase_16 | AC | 2 ms
4,384 KB |
testcase_17 | AC | 1 ms
4,380 KB |
testcase_18 | AC | 2 ms
4,384 KB |
testcase_19 | AC | 1 ms
4,380 KB |
testcase_20 | AC | 1 ms
4,384 KB |
testcase_21 | AC | 2 ms
4,380 KB |
testcase_22 | AC | 3 ms
4,380 KB |
testcase_23 | AC | 3 ms
4,380 KB |
testcase_24 | AC | 4 ms
4,384 KB |
testcase_25 | AC | 2 ms
4,384 KB |
testcase_26 | AC | 5 ms
4,384 KB |
testcase_27 | AC | 4 ms
4,380 KB |
testcase_28 | AC | 4 ms
4,384 KB |
testcase_29 | AC | 2 ms
4,384 KB |
testcase_30 | AC | 3 ms
4,380 KB |
testcase_31 | AC | 5 ms
4,380 KB |
testcase_32 | AC | 34 ms
29,588 KB |
testcase_33 | AC | 37 ms
17,296 KB |
testcase_34 | AC | 66 ms
37,800 KB |
testcase_35 | AC | 47 ms
31,656 KB |
testcase_36 | AC | 33 ms
4,520 KB |
testcase_37 | AC | 32 ms
27,488 KB |
testcase_38 | AC | 26 ms
23,396 KB |
testcase_39 | AC | 98 ms
39,772 KB |
testcase_40 | AC | 42 ms
15,264 KB |
testcase_41 | AC | 46 ms
25,504 KB |
testcase_42 | AC | 57 ms
37,728 KB |
testcase_43 | AC | 70 ms
27,532 KB |
testcase_44 | AC | 73 ms
35,620 KB |
testcase_45 | AC | 73 ms
8,996 KB |
testcase_46 | AC | 94 ms
35,616 KB |
testcase_47 | AC | 36 ms
21,404 KB |
testcase_48 | AC | 53 ms
37,656 KB |
testcase_49 | AC | 51 ms
37,772 KB |
testcase_50 | AC | 30 ms
27,488 KB |
testcase_51 | AC | 92 ms
35,616 KB |
testcase_52 | TLE | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
testcase_60 | -- | - |
testcase_61 | -- | - |
testcase_62 | -- | - |
testcase_63 | -- | - |
testcase_64 | -- | - |
testcase_65 | -- | - |
testcase_66 | -- | - |
testcase_67 | -- | - |
testcase_68 | -- | - |
testcase_69 | -- | - |
testcase_70 | -- | - |
testcase_71 | -- | - |
testcase_72 | -- | - |
testcase_73 | -- | - |
testcase_74 | -- | - |
testcase_75 | -- | - |
testcase_76 | -- | - |
testcase_77 | -- | - |
testcase_78 | -- | - |
testcase_79 | -- | - |
testcase_80 | -- | - |
testcase_81 | -- | - |
testcase_82 | -- | - |
testcase_83 | -- | - |
testcase_84 | -- | - |
testcase_85 | -- | - |
testcase_86 | -- | - |
testcase_87 | -- | - |
testcase_88 | -- | - |
testcase_89 | -- | - |
testcase_90 | -- | - |
testcase_91 | -- | - |
testcase_92 | -- | - |
testcase_93 | -- | - |
ソースコード
#include <stdio.h> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <list> #include <iterator> #include <assert.h> #pragma warning(disable:4996) typedef long long ll; #define MIN(a, b) ((a)>(b)? (b): (a)) #define MAX(a, b) ((a)<(b)? (b): (a)) #define LINF 9223300000000000000 #define INF 2140000000 const long long MOD = 1000000007; using namespace std; vector<int> pp; void preparePrime( int maxp ) { int i; vector<int> a(maxp+1); for(i=2; i<=maxp; i++) { int k=i+i; while(k<=maxp) { a[k]=1; k+=i; } } for(i=2; i<=maxp; i++) { if(a[i]==0) pp.push_back( i ); } return; } ll decompositPrime( ll a, vector<pair<ll,ll> >& vv ) { //preparePrime( (int)sqrt((double)a)+1 ); int i; for(i=0; i<(int)pp.size(); i++) { int count = 0; while(a % pp[i] == 0 ) { a /= pp[i]; count ++; } if(count>0) vv.push_back( make_pair( pp[i], count ) ); if (a==1) break; } if(a>1) { return 1; } return 0; } int s[100005][303]; int main(int argc, char* argv[]) { int n; scanf("%d", &n); preparePrime(2001); vector<int> mp(2001,-1); int i; for(i=0; i<(int)pp.size(); i++) { mp[pp[i]]=i; } vector<pair<ll,ll> > vv; for(i=0; i<n; i++) { int a; scanf("%d", &a); vv.clear(); ll ret = decompositPrime(a, vv); assert(ret==0); int k; for(k=0; k<(int)pp.size(); k++) { s[i+1][k]=s[i][k]; } for(k=0; k<(int)vv.size(); k++) { int id=mp[vv[k].first]; s[i+1][id]=s[i+1][id]+vv[k].second; } } int Q; scanf("%d", &Q); for(i=0; i<Q; i++) { int p, l, r; scanf("%d %d %d", &p, &l, &r); vv.clear(); ll ret = decompositPrime(p, vv); if(ret) { printf("NO\n"); continue; } int k; int ng=0; for(k=0; k<(int)vv.size(); k++) { int id=mp[vv[k].first]; if(id<0) { ng=1; break; } if(s[r][id]-s[l-1][id]<vv[k].second) { ng=1; break; } } if(ng) { printf("NO\n"); } else { printf("Yes\n"); } } return 0; }