QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#808908#3033. Harry Potter and the Palindromic Radiusucup-team5071#0 0ms0kbC++20836b2024-12-11 09:36:212024-12-11 09:36:22

Judging History

This is the latest submission verdict.

  • [2024-12-11 09:36:22]
  • Judged
  • Verdict: 0
  • Time: 0ms
  • Memory: 0kb
  • [2024-12-11 09:36:21]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
void solve()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vector<int> g(n);
    for (int i = 1; i < n; i++)
    {
        int p = (a[i] == 0);
        if (i + 1 < n)
            g[i + 1] = p;
    }
    vector<int> z(n);
    cout << 4 << "\n";
    for (g[0] = 0; g[0] < 2; g[0]++)
    {
        for (g[1] = 0; g[1] < 2; g[1]++)
        {
            z[0] = g[0], z[1] = g[1];
            for (int i = 2; i < n; i++)
                z[i] = z[i - 2] ^ g[i];
            for (int i = 0; i < n; i++)
                cout << z[i];
            cout << "\n";
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while (T--)
        solve();
}

詳細信息


Pretests


Final Tests

Test #1:

score: 0
Output Limit Exceeded

input:

131112
2
0 0
2
0 1
2
0 0
2
1 0
2
0 0
2
0 1
2
0 0
2
0 1
3
0 1 0
3
0 1 1
3
0 0 0
3
0 1 0
3
0 1 0
3
0 2 0
3
0 0 0
3
1 0 0
3
0 0 0
3
1 0 0
3
0 1 0
3
0 2 0
3
0 0 0
3
0 0 1
3
0 1 0
3
0 2 0
4
0 1 1 0
4
0 1 2 0
4
0 0 1 0
4
0 0 1 1
4
0 1 0 0
4
0 1 0 1
4
0 0 0 0
4
0 0 1 0
4
0 0 1 0
4
1 0 1 0
4
0 1 1 0
4
0 1 2...

output:

4
00
01
10
11
4
00
01
10
11
4
00
01
10
11
4
00
01
10
11
4
00
01
10
11
4
00
01
10
11
4
00
01
10
11
4
00
01
10
11
4
000
010
101
111
4
000
010
101
111
4
001
011
100
110
4
000
010
101
111
4
000
010
101
111
4
000
010
101
111
4
001
011
100
110
4
001
011
100
110
4
001
011
100
110
4
001
011
100
110
4
000
01...

result: