QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#184102#6784. Problem Preparationucup-team004#AC ✓6ms3624kbC++20802b2023-09-20 12:45:482023-09-20 12:45:48

Judging History

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

  • [2023-09-20 12:45:48]
  • 评测
  • 测评结果:AC
  • 用时:6ms
  • 内存:3624kb
  • [2023-09-20 12:45:48]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

void solve() {
    int n;
    std::cin >> n;
    
    std::vector<int> s(n);
    for (int i = 0; i < n; i++) {
        std::cin >> s[i];
    }
    
    if (n < 10 || n > 13) {
        std::cout << "No\n";
        return;
    }
    
    std::sort(s.begin(), s.end());
    if (s[0] != 1 || s[1] != 1) {
        std::cout << "No\n";
        return;
    }
    
    for (int i = 1; i < n - 1; i++) {
        if (s[i] - s[i - 1] > 2) {
            std::cout << "No\n";
            return;
        }
    }
    std::cout << "Yes\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int t;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

8
9
1 2 3 4 5 6 7 8 9
10
1 2 3 4 5 6 7 8 9 10
11
999 1 1 2 3 4 5 6 7 8 9
11
999 1 3 5 7 9 11 13 17 19 21
10
15 1 13 17 1 7 9 5 3 11
13
1 1 1 1 1 1 1 1 1 1 1 1 2
10
2 3 4 5 6 7 8 9 10 11
10
15 1 13 3 6 5 4 7 1 14

output:

No
No
Yes
No
Yes
Yes
No
No

result:

ok 8 lines

Test #2:

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

input:

10000
9
1 1 1 1 1 1 1 1 2
10
1 1 1 1 1 1 1 1 1 2
10
0 1 1 1 1 1 1 1000 1 1
11
1 2 3 4 5 6 7 8 9 10 11
11
1 1 2 3 4 5 6 7 8 9 10
11
-1 1 1 1 1 1 1 1 2 1 1
11
1 1 3 5 7 9 11 13 15 17 19
12
1 1 3 5 7 9 11 13 15 17 19 1000
12
1 2 3 5 7 9 11 13 15 17 19 1000
11
1 1 2 3 4 5 6 9 11 17 22
13
10 1 5 9 10 5 7...

output:

No
Yes
No
No
Yes
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
No
No
Yes
No
No
No
Yes
No
No
Yes
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
Yes
Yes
No
No
No
No
No
No
No
No...

result:

ok 10000 lines