QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#591236#5465. Maximum GCDice_cup#WA 48ms4028kbC++14384b2024-09-26 14:53:332024-09-26 14:53:37

Judging History

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

  • [2024-09-26 14:53:37]
  • 评测
  • 测评结果:WA
  • 用时:48ms
  • 内存:4028kb
  • [2024-09-26 14:53:33]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,a[100100],ans;
bool ck(int x){
	int fl=1;
	for(int i=1;i<=n;i++){
		if(a[i]%x!=0&&(a[i]+1)/2<x)fl=0;
	}
	return fl;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	ans=(a[1]+1)/2;
	for(int i=1;i*i<=a[1];i++){
		if(a[1]%i==0&&ck(n/i)){
			ans=max(ans,n/i);
		}
	}
	cout<<ans;
}

詳細信息

Test #1:

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

input:

3
3 10 7

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: -100
Wrong Answer
time: 48ms
memory: 4028kb

input:

100000
154183567 764881828 59831034 828193326 391773598 487722171 451196811 245718514 750259573 762740115 821999084 28801227 218042831 918898632 881477122 891010192 55732830 509020430 594855913 455478382 456571462 705949609 471532655 550005603 861581472 984465652 883456918 463213251 626620153 371990...

output:

1886

result:

wrong answer 1st numbers differ - expected: '3772', found: '1886'