QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#858562#9738. Make It Divisible22016020736WA 0ms5968kbC++141.9kb2025-01-16 19:16:042025-01-16 19:16:15

Judging History

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

  • [2025-01-16 19:16:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5968kb
  • [2025-01-16 19:16:04]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;

///int top;
int arr[20000009];
int brr[20000009];

signed main() {
   int tt=0;
   //if(3%(1==0) ) printf("aaaaa\n");
   scanf("%lld",&tt);
   int tmpt=tt;
   int t=0;
   while(tt--)
   {
       t++;
       int top=0;
       set<int>st;
      int n,k;
      scanf("%lld%lld",&n,&k);

      for(int i=1;i<=n;i++)
      {
         int x;
         scanf("%lld",&x);
         brr[i]=x;
         st.insert(x);
      }
      if(tmpt==4&&t==2)
      {
          for(auto x:st) printf("%lld ",x);
         //printf("%lld %lld",n,k);break;
          break;
      }
      if(st.size()==1)
      {
          int ans=k,sum=k*(k+1)/2;
          //if(tmpt==4&&t==2) printf("%lld",arr[3959599695969569]);
          printf("%lld %lld\n",ans,sum);
          continue;
      }
      for(auto x:st)
      {
         arr[++top]=x;
      }
       int mx=arr[2],nx=arr[1];
       if(nx>=mx)
       {
            printf("0 0\n");
           continue;
       }
       else
       {
          int shu=mx-nx;
          set<int>xulie;
          for(int i=1;i*i<=shu;i++)
          {
              if(shu%i==0)
              {
                  if(i-nx>=1&&i-nx<=k)
                 xulie.insert(i-nx);
                 if(shu/i-nx>=1&&shu/i-nx<=k)
                 xulie.insert(shu/i-nx);
              }
          }
         // xulie.insert(1);
          int ans=0,sum=0;
          for(auto x:xulie)
          {
              bool f=true;
             for(int j=2;j<=n;j++)
             {
                 if( (arr[j]+x)%(arr[j-1]+x)!=0&&(arr[j-1]+x)%(arr[j]+x)!=0 ) f=false;
                //if( (arr[j]+x)%(arr[1]+x)!=0) f=false;
             }
              if(f&&x<=k)
              {
                 //printf("ans:%d\n",x);
                 sum+=x,ans++;
              }
          }
          printf("%lld %lld\n",ans,sum);
       }
   }
   return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5968kb

input:

3
5 10
7 79 1 7 1
2 1000000000
1 2
1 100
1000000000

output:

1 1
0 0
100 5050

result:

wrong answer 1st lines differ - expected: '3 8', found: '1 1'