QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#740821#5465. Maximum GCDucup-team2179WA 12ms3888kbC++231.9kb2024-11-13 11:41:252024-11-13 11:41:26

Judging History

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

  • [2024-11-13 11:41:26]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:3888kb
  • [2024-11-13 11:41:25]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define pb push_back
bool debug=1;

#define dbg(x) if(debug)cerr << BRIGHT_CYAN << #x << COLOR_RESET << " = " << (x) << NORMAL_FAINT << " (L" << __LINE__ << ") " << __FILE__ << COLOR_RESET << endl
using namespace std;void ass(string err){cout<<err<<"\n";exit(0);}void ass(int err){cout<<err<<"\n";exit(0);}
typedef pair<int,int> pii;
const string COLOR_RESET = "\033[0m",  BRIGHT_CYAN = "\033[1;36m", NORMAL_FAINT = "\033[0;2m";




void solve()
{
	ios::sync_with_stdio(false);cin.tie(0);mt19937_64 engie(202202052100238523);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n;i++)
		cin >> a[i];
	sort(a.begin(), a.end());
	a.erase(unique(a.begin(), a.end()),a.end());
	if(a.size()==1){
		cout << a[0];
		return;
	}
	if((a[1]-1)/2>=a[0])
		cout << a[0];
	else
		cout << max(1ll,(a[0] - 1) / 2);
}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
	int t=1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

//__builtin_popcountl( ) 计算二进制1个数
//cout<<fixed<<setprecision(2);输出小数,四舍六入五取偶 
//__builtin_ctz( )返回末尾0的个数
//__builtin_clz( ) 返回前导0的个数
//__builtin_parity( )返回1的个数的奇偶性,偶数返回0
//__builtin_ffs( )返回最后一个1在第几位
//__builtin_sqrt( )快速开平方 
//stoll()字符串转为长整形
//点(x,y)的极角atan2(y,x)
//点(x,y)逆时针旋转A度,(x*cosA-y*sinA ,  x*sinA+y*cosA ) 
//C(n,k)+C(n,k-1)=(n+1,k)
//string s(str,stridx,strlen) //将字符串str内“始于stridx且长度顶多strlen”
//(从stridx开始往后strlen个字符)的部分作为字符串的初值
/*
int fp(int a,int b)
{
	int re=1;
	while(b)
	{
		if(b&1)re*=a;
		a*=a;re%=M;a%=M;
		b=b>>1;
	}
	return re;
}
*/

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3744kb

input:

3
3 10 7

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 12ms
memory: 3828kb

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:

3772

result:

ok 1 number(s): "3772"

Test #3:

score: -100
Wrong Answer
time: 3ms
memory: 3888kb

input:

100000
80 88 53 77 74 63 57 71 75 74 27 14 38 23 24 75 33 89 81 33 100 56 53 77 55 54 63 80 100 15 70 24 100 65 95 22 34 12 31 30 83 20 68 87 23 53 53 55 72 13 57 94 27 94 93 81 96 57 11 81 18 53 34 67 77 65 38 45 45 33 66 47 56 61 60 55 13 61 60 83 24 68 88 50 59 44 27 99 22 82 16 96 62 60 98 48 78...

output:

4

result:

wrong answer 1st numbers differ - expected: '5', found: '4'