QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#939491#4929. Longest Unfriendly Subsequencejustin2718280 57ms4352kbC++20611b2025-03-17 13:58:152025-03-17 13:58:21

Judging History

This is the latest submission verdict.

  • [2025-03-17 13:58:21]
  • Judged
  • Verdict: 0
  • Time: 57ms
  • Memory: 4352kb
  • [2025-03-17 13:58:15]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
    int t;
    cin >> t;
    for (int qwerty = 0; qwerty < t; qwerty++) {
        int n;
        cin >> n;
        int a[n];
        for (int i = 0; i < n; i++) cin >> a[i];
        int ans = 0;
        for (int i = 0; i < 3; i++) {
            int ans1 = 0;
            int ans2 = 0;
            for (int k: a) {
                if (k%3 == (ans1+i)%3) ans1++;
                if (k%3 == (i-ans2)%3) ans2++;
            }
            ans = max(ans, max(ans1, ans2));
        }
        cout << ans << "\n";
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 3
Accepted
time: 56ms
memory: 4352kb

input:

1
200000
259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 2...

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Wrong Answer
time: 57ms
memory: 4352kb

input:

1
200000
1521 1638 11981 18811 20091 22081 30494 31501 42139 42282 48197 55520 57632 69584 81745 85026 90303 91482 92176 98507 108061 108743 111257 121226 127217 127449 137116 163474 169192 175764 181243 185402 191244 198775 202845 212156 217723 220058 223478 224205 227614 228398 230425 232567 24480...

output:

66138

result:

wrong answer 1st lines differ - expected: '198858', found: '66138'

Subtask #2:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 0ms
memory: 3584kb

input:

3
5
1 2 1 2 1
7
1 2 3 2 1 2 3
8
1 10 10 1 1 100 100 1

output:

2
6
1

result:

wrong answer 3rd lines differ - expected: '4', found: '1'

Subtask #3:

score: 0
Wrong Answer

Test #19:

score: 0
Wrong Answer
time: 0ms
memory: 3584kb

input:

1
500
537076440 691668159 871942500 537076440 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 537076440 6916...

output:

1

result:

wrong answer 1st lines differ - expected: '361', found: '1'

Subtask #4:

score: 0
Wrong Answer

Test #79:

score: 0
Wrong Answer
time: 22ms
memory: 4224kb

input:

1
200000
1 3 3 2 2 3 3 1 2 3 1 1 3 3 3 2 1 1 2 3 2 1 3 3 3 1 2 2 1 3 1 2 1 2 3 2 3 3 2 2 3 2 3 2 3 1 1 1 1 1 3 1 3 2 3 3 3 3 1 3 2 1 3 2 3 2 3 1 1 1 1 3 3 2 3 2 1 2 2 3 2 3 2 2 2 2 2 2 3 2 1 2 2 1 1 3 2 1 2 1 1 3 3 3 2 1 2 2 2 1 3 3 2 3 2 1 3 3 2 2 1 3 1 3 2 1 2 3 2 1 2 3 2 2 3 2 1 2 1 1 1 1 1 1 1 3...

output:

66572

result:

wrong answer 1st lines differ - expected: '66691', found: '66572'

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #3:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%