QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#62529#4596. IronforgeqinjianbinCompile Error//C++2.1kb2022-11-19 23:22:012022-11-19 23:22:02

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-19 23:22:02]
  • 评测
  • [2022-11-19 23:22:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, m, a[N], b[N];
int minv[N];
int L[N], R[N];
vector<int> pos[N];

bool check(int p, int l, int r)
{
    if (!pos[p].size() || pos[p].back() < l) return 0;
    int x = *lower_bound(pos[p].begin(), pos[p].end(), l);
    return (x <= r);
}

void solve()
{
    cin >> n >> m;
    for(int i = 1 ; i < N ; i ++ ) pos[i].clear();
    for(int i = 1 ; i <= n ; i ++ ) cin >> a[i];
    for(int i = 1 ; i < n ; i ++ ) cin >> b[i];
    for(int i = 1 ; i <= n ; i ++ )
    {
        int x = a[i];
        for(int j = 2 ; j * j <= x ; j ++ )
        {
            if(x % j == 0)
            {
                while(x % j == 0) x /= j;
                pos[j].push_back(i);
            }
        }
        if(x > 1) pos[x].push_back(i);
    }

    for(int i = n ; i ; i -- )
    {
        R[i] = i;
        while(R[i] < n && check(b[R[i]], i, R[i]))
            R[i] = R[R[i] + 1];
    }

    for(int i = 1 ; i <= n ; i ++ )
    {
        if(i > 1 && R[i - 1] >= i)
        {
            if(check(b[i - 1], i, R[i]))
            {
                L[i] = L[i - 1];
                R[i] = R[i - 1];
            }
            else L[i] = i;
        }
        else
        {
            while(1)
            {
                bool flag = false;
                while(L[i] > 1 && check(b[L[i] - 1], L[i], R[i]))
                {
                    flag = true;
                    L[i] = L[L[i] - 1];
                }
                while(R[i] < n && check(b[R[i]], L[i], R[i]))
                {
                    flag = true;
                    R[i] = R[R[i] + 1];
                }
                if(!flag) break;
            }
        }
    }

    for(int i = 1 ; i <= m ; i ++ )
    {
        int a, b;
        cin >> a >> b;
        if(L[a] <= b && R[a] >= b) puts("Yes");
        else puts("No");
    }
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    int T = 1;
    cin >> T;
    while(T -- ) solve();
    return 0;
} 作者:社会你典儿 https://www.bilibili.com/read/cv18073059/ 出处:bilibili

Details

answer.code:90:3: error: ‘作者:社会你典儿’ does not name a type
   90 | } 作者:社会你典儿 https://www.bilibili.com/read/cv18073059/ 出处:bilibili
      |   ^~~~~~~~~~~~~~~~