QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#473475#5465. Maximum GCDSakib_SafwanWA 26ms8272kbC++202.3kb2024-07-12 04:50:262024-07-12 04:50:26

Judging History

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

  • [2024-07-12 04:50:26]
  • 评测
  • 测评结果:WA
  • 用时:26ms
  • 内存:8272kb
  • [2024-07-12 04:50:26]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;


typedef long long ll;
typedef long double ld;

#define endl "\n"
#define all(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
//#define int long long



// Don't Start typing till you complete the idea.


// Check these things for WA and before submitting
// 1. Did you clear all the global arrays
// 2. Did you checked your <= >= < > 
// 3. Did you take the input properly. Did you use break or return while taking input?
// 4. Did you divide by 0.
// 5. Check array , vector , etc size
// 6. in the while loop did you miss something that would cause infinite loop?
// 7. Did you save your dp?
// 8. Are you trying to use something after deleting it?
// 9. Did you read the problem statement wrong?
// 10. Did you check the constrains of the problem properly
// 11. Did you checked for smaller cases like 1 , 0 , etc
// 12. Is it something to with overflow?
// 13. Did you initialized all the variables properly?
// 14. Did you use the formulas correctly?

// STRESS TESTING !!!!!! STRESS TESTING !!!!!
// STRESS Testing Not working?
// Stress test for multiple cases? 
// Stress test for big inputs?
// Stress test for really small inputs?
// Even then if it doesn't work -> Did you wrote the wrong Brute force code


// Check these things if you are not generating ideas
// 1. Did you try thinking it in reverse?
// 2. Read the problem statement again
// 3. Check the constraints again
// 4. Try smaller cases in notebook and try to expand
// 5. Think about invariants
// 6. Think simpler ideas maybe?
// 7. Think brute force and try to get something out of it.
// 8. Maybe take a deep breath and take a break for few minutes and drink some water? :3 


void GG()
{
	ll n;
    cin >> n;
    set<ll> st;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        st.insert(x);
    }
    if(st.size() == 1) cout << *st.begin() << endl;
    ll v0 = *st.begin();
    st.erase(v0);
    ll v1 = *st.begin();
    if(v0 * 2 <= v1) cout << v0 << endl;
    else cout << v0 / 2 << endl;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int ttc=1;
	// cin>>ttc;
	//int cnt=0;
	while(ttc--)
	{
		//cout<<"Case "<<++cnt<<": ";
		GG();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
3 10 7

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 26ms
memory: 8204kb

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: 0
Accepted
time: 6ms
memory: 3780kb

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:

5

result:

ok 1 number(s): "5"

Test #4:

score: 0
Accepted
time: 10ms
memory: 3660kb

input:

100000
999999598 999999894 999999159 999999706 999999201 999999362 999999889 999999054 999999169 999999662 999999967 999999278 999999478 999999996 999999011 999999630 999999240 999999446 999999989 999999526 999999874 999999704 999999555 999999997 999999622 999999847 999999791 999999729 999999697 999...

output:

499999500

result:

ok 1 number(s): "499999500"

Test #5:

score: 0
Accepted
time: 26ms
memory: 8272kb

input:

100000
2339018 1749754 3376731 9508803 1986463 3632005 6226628 1462120 8271360 8846247 8379452 2960858 1687623 3059513 9805949 8592853 4763971 6382780 1552229 8402035 9055846 6039035 1412389 9103272 3160554 4293404 4986833 7422294 1031511 3281256 7401944 2250268 1895990 1052625 6425782 1547099 61500...

output:

500018

result:

ok 1 number(s): "500018"

Test #6:

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

input:

1
4360

output:

4360
2180

result:

wrong answer Output contains longer sequence [length = 2], but answer contains 1 elements