結果

問題 No.854 公平なりんご分配
ユーザー ChanyuhChanyuh
提出日時 2020-02-13 22:49:41
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,612 bytes
コンパイル時間 1,068 ms
コンパイル使用メモリ 107,936 KB
実行使用メモリ 248,960 KB
最終ジャッジ日時 2024-04-15 23:29:04
合計ジャッジ時間 23,612 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
8,064 KB
testcase_01 AC 5 ms
8,064 KB
testcase_02 AC 5 ms
8,064 KB
testcase_03 AC 5 ms
8,064 KB
testcase_04 AC 5 ms
8,064 KB
testcase_05 AC 5 ms
8,064 KB
testcase_06 AC 6 ms
8,064 KB
testcase_07 AC 6 ms
8,064 KB
testcase_08 AC 5 ms
8,064 KB
testcase_09 AC 5 ms
8,064 KB
testcase_10 AC 5 ms
8,064 KB
testcase_11 AC 5 ms
8,064 KB
testcase_12 AC 5 ms
8,320 KB
testcase_13 AC 5 ms
8,192 KB
testcase_14 AC 6 ms
8,064 KB
testcase_15 AC 6 ms
8,192 KB
testcase_16 AC 5 ms
8,192 KB
testcase_17 AC 6 ms
8,320 KB
testcase_18 AC 6 ms
8,192 KB
testcase_19 AC 6 ms
8,192 KB
testcase_20 AC 6 ms
8,064 KB
testcase_21 AC 5 ms
8,192 KB
testcase_22 AC 9 ms
8,320 KB
testcase_23 AC 9 ms
9,216 KB
testcase_24 AC 13 ms
10,112 KB
testcase_25 AC 9 ms
8,960 KB
testcase_26 AC 14 ms
10,112 KB
testcase_27 AC 12 ms
10,240 KB
testcase_28 AC 9 ms
8,320 KB
testcase_29 AC 7 ms
8,320 KB
testcase_30 AC 9 ms
8,832 KB
testcase_31 AC 13 ms
9,856 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 62 ms
11,136 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 113 ms
31,104 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 153 ms
20,096 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 197 ms
36,608 KB
testcase_53 AC 127 ms
36,096 KB
testcase_54 AC 207 ms
41,984 KB
testcase_55 AC 99 ms
36,224 KB
testcase_56 AC 90 ms
37,888 KB
testcase_57 AC 109 ms
31,872 KB
testcase_58 AC 145 ms
17,536 KB
testcase_59 AC 74 ms
28,928 KB
testcase_60 AC 135 ms
31,872 KB
testcase_61 AC 58 ms
12,288 KB
testcase_62 AC 145 ms
28,032 KB
testcase_63 AC 138 ms
29,440 KB
testcase_64 AC 47 ms
15,872 KB
testcase_65 WA -
testcase_66 AC 93 ms
23,040 KB
testcase_67 AC 185 ms
46,592 KB
testcase_68 AC 152 ms
24,192 KB
testcase_69 AC 189 ms
82,688 KB
testcase_70 AC 87 ms
31,616 KB
testcase_71 AC 98 ms
33,664 KB
testcase_72 AC 85 ms
11,392 KB
testcase_73 AC 148 ms
56,448 KB
testcase_74 AC 247 ms
67,328 KB
testcase_75 AC 119 ms
33,920 KB
testcase_76 AC 206 ms
54,144 KB
testcase_77 AC 236 ms
75,648 KB
testcase_78 AC 174 ms
26,112 KB
testcase_79 AC 215 ms
47,744 KB
testcase_80 AC 201 ms
50,048 KB
testcase_81 AC 177 ms
52,096 KB
testcase_82 AC 911 ms
248,832 KB
testcase_83 AC 904 ms
248,832 KB
testcase_84 AC 906 ms
248,832 KB
testcase_85 AC 949 ms
248,832 KB
testcase_86 AC 796 ms
248,832 KB
testcase_87 AC 966 ms
248,960 KB
testcase_88 AC 982 ms
248,960 KB
testcase_89 AC 1,000 ms
248,832 KB
testcase_90 AC 986 ms
248,960 KB
testcase_91 AC 986 ms
248,832 KB
testcase_92 WA -
testcase_93 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

vector<int> prime_list(int l,int r){//[l,r]に含まれる素数表
    vector<int> li(r+1,1);
    for(int i=2;i<=r;i++){
        if (!li[i]) continue;
        for(int j=2*i;j<=r;j+=i){
            li[j]=0;
        }
    }
    vector<int> res={};
    for(int i=max(2,l);i<=r;i++){
        if (li[i]) res.push_back(i);
    }
    return res;
}

vector<int> div(int &s,vector<int> V){
    int m=V.size();
    vector<int> res(m,0);
    if(s==0){
        rep(i,m){
            res[i]=10000;
        }
        return res;
    }
    rep(i,m){
        while(s%V[i]==0){
            res[i]++;
            s/=V[i];
        }
    }
    
    return res;
}

int n,a[100010],q;
vector<int> A[100010],S[100010];

void solve(){
    cin >> n;
    vector<int> P=prime_list(0,2001);
    S[0].resize(P.size(),0);
    rep(i,n){
        S[i+1].resize(P.size(),0);
        cin >> a[i];
        A[i]=div(a[i],P);
        rep(k,P.size()){
            S[i+1][k]=S[i][k]+A[i][k];
        }
    }
    cin >> q;
    rep(i,q){
        int p,l,r;cin >> p >> l >> r;
        vector<int> R=div(p,P);
        vector<int> T(P.size(),0);
        bool flag=true;
        rep(k,P.size()){
            T[k]=S[r][k]-S[l-1][k];
            //cout << P[k] << " " << T[k] << " " << R[k] << endl;
            if(R[k]>T[k]){
                flag=false;
                break;
            }
        }
        if(T[0]>=10000){cout << "Yes" << endl;continue;}
        if(p!=1) {cout << "NO" << endl;continue;}
        if(flag) cout << "Yes" << endl;
        else cout << "NO" << endl;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}
0