QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501792#7639. Forbidden SetSakib_Safwan#AC ✓0ms3856kbC++202.8kb2024-08-02 22:48:372024-08-02 22:48:38

Judging History

This is the latest submission verdict.

  • [2024-08-02 22:48:38]
  • Judged
  • Verdict: AC
  • Time: 0ms
  • Memory: 3856kb
  • [2024-08-02 22:48:37]
  • Submitted

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 

const int N = 1000;
int prime[N + 3];
vector<int> lst;
void sieve(){
    for(int i = 2; i <= N; i++){
        if(!prime[i]){
            for(int j = i * i ; j <= N; j += i) prime[j] = 1;
        }
        if(!prime[i]) lst.pb(i); 
    }
    
}

void GG()
{
    vector<int> ase(10 , 1);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        ase[x] = 0;
    }
    if(ase[2]) cout << 2 << endl;
    else if(ase[3]) cout << 3 << endl;
    else if(ase[5]) cout << 5 << endl;
    else if(ase[7]) cout << 7 << endl;
    else if(ase[1]) cout << 11 << endl;
    else if(ase[9]){
        if(ase[8]) cout << 89 << endl;
        else if(ase[4] && ase[0]) cout << 409 << endl;
        else if(ase[4]) cout << 449 << endl;
        else cout << -1 << endl;
    }
    else cout << -1 << endl;
    // for(auto x : lst){
    //     cout << x << endl;
    // }
}

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

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

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

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

input:

7
0
1
2
4
6
8
9

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

9
0
1
2
3
5
6
7
8
9

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

9
0
2
3
4
5
6
7
8
9

output:

11

result:

ok 1 number(s): "11"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

9
0
1
3
4
5
6
7
8
9

output:

2

result:

ok 1 number(s): "2"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

9
0
1
2
4
5
6
7
8
9

output:

3

result:

ok 1 number(s): "3"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

9
0
1
2
3
4
6
7
8
9

output:

5

result:

ok 1 number(s): "5"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

9
0
1
2
3
4
5
7
8
9

output:

-1

result:

ok 1 number(s): "-1"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

9
0
1
2
3
4
5
6
8
9

output:

7

result:

ok 1 number(s): "7"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

9
0
1
2
3
4
5
6
7
9

output:

-1

result:

ok 1 number(s): "-1"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

9
0
1
2
3
4
5
6
7
8

output:

-1

result:

ok 1 number(s): "-1"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

4
1
3
7
9

output:

2

result:

ok 1 number(s): "2"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

7
1
2
3
4
5
7
8

output:

-1

result:

ok 1 number(s): "-1"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

8
0
1
2
3
4
5
7
8

output:

-1

result:

ok 1 number(s): "-1"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

8
1
2
3
4
5
6
7
8

output:

-1

result:

ok 1 number(s): "-1"

Test #15:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

5
1
2
3
5
7

output:

89

result:

ok 1 number(s): "89"

Test #16:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

6
1
2
3
5
7
8

output:

409

result:

ok 1 number(s): "409"

Test #17:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

8
0
1
2
3
5
6
7
8

output:

449

result:

ok 1 number(s): "449"

Test #18:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

5
2
3
5
7
9

output:

11

result:

ok 1 number(s): "11"

Test #19:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

6
1
2
4
5
7
8

output:

3

result:

ok 1 number(s): "3"

Test #20:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

8
0
1
2
4
5
7
8
9

output:

3

result:

ok 1 number(s): "3"

Test #21:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

8
0
1
3
5
6
7
8
9

output:

2

result:

ok 1 number(s): "2"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

8
0
2
3
5
6
7
8
9

output:

11

result:

ok 1 number(s): "11"

Test #23:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

8
0
2
4
5
6
7
8
9

output:

3

result:

ok 1 number(s): "3"

Test #24:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

7
0
2
3
5
6
7
8

output:

11

result:

ok 1 number(s): "11"

Test #25:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

8
2
3
4
5
6
7
8
9

output:

11

result:

ok 1 number(s): "11"

Test #26:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

8
0
1
2
5
6
7
8
9

output:

3

result:

ok 1 number(s): "3"

Test #27:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

1
2

output:

3

result:

ok 1 number(s): "3"

Test #28:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

10
0
1
2
3
4
5
6
7
8
9

output:

-1

result:

ok 1 number(s): "-1"

Test #29:

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

input:

7
0
2
3
5
6
8
9

output:

7

result:

ok 1 number(s): "7"

Test #30:

score: 0
Accepted
time: 0ms
memory: 3500kb

input:

8
1
2
3
4
5
6
7
9

output:

-1

result:

ok 1 number(s): "-1"

Test #31:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

4
0
2
6
7

output:

3

result:

ok 1 number(s): "3"

Test #32:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

5
2
3
4
6
8

output:

5

result:

ok 1 number(s): "5"

Test #33:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

6
0
2
3
4
5
8

output:

7

result:

ok 1 number(s): "7"

Test #34:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

3
1
5
7

output:

2

result:

ok 1 number(s): "2"

Test #35:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

3
1
4
9

output:

2

result:

ok 1 number(s): "2"

Test #36:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

6
2
3
4
6
7
9

output:

5

result:

ok 1 number(s): "5"

Test #37:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

7
1
2
3
4
5
6
8

output:

7

result:

ok 1 number(s): "7"

Test #38:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

6
0
1
3
5
8
9

output:

2

result:

ok 1 number(s): "2"

Test #39:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

3
1
3
4

output:

2

result:

ok 1 number(s): "2"

Test #40:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

4
1
5
6
9

output:

2

result:

ok 1 number(s): "2"

Test #41:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

7
0
2
3
5
6
7
9

output:

11

result:

ok 1 number(s): "11"

Test #42:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

4
0
3
7
9

output:

2

result:

ok 1 number(s): "2"

Extra Test:

score: 0
Extra Test Passed