QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#856296#9738. Make It Divisible22016020736#WA 1ms3840kbC++141.4kb2025-01-13 20:46:042025-01-13 20:46:06

Judging History

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

  • [2025-01-13 20:46:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3840kb
  • [2025-01-13 20:46:04]
  • 提交

answer

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

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


signed main() {
   int tt=0;
   scanf("%lld",&tt);
   while(tt--)
   {
       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);
         st.insert(x);
      }
      if(st.size()==1)
      {
          int ans=k,sum=k*(k+1)/2;
          printf("%lld %lld\n",ans,sum);
          continue;
      }
      for(auto x:st)
      {
         arr[++top]=x;
      }
       int mx=arr[top],nx=arr[top-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)
              {
                 xulie.insert(i+1);
                 xulie.insert(shu/i+1);
              }
          }
          xulie.insert(1);
          int ans=0,sum=0;
          for(auto x:xulie)
          {
              bool f=true;
             for(int j=1;j<top;j++)
             {
                if( (arr[top]+x)%(arr[j]+x)!=0) f=false;
             }
              if(f&&x<=k)
              {
                 //printf("ans:%d\n",x);
                 sum+=x,ans++;
              }
          }
          printf("%lld %lld\n",ans,sum);
       }
   }
   return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3840kb

input:

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

output:

3 8
0 0
100 5050

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3840kb

input:

4
201 1000000000
1 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5...

output:

1 1
1 1
1 1
1 1

result:

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