QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321087#8209. Curly Palindromesucup-team2894#WA 1ms3960kbC++202.3kb2024-02-04 03:38:542024-02-04 03:38:54

Judging History

This is the latest submission verdict.

  • [2024-02-04 03:38:54]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3960kb
  • [2024-02-04 03:38:54]
  • Submitted

answer

#include <bits/stdc++.h>
#define fr first
#define sc second
#define all(a) (a).begin(), (a).end()
#define unique(a) a.resize(unique(a.begin(), a.end()) - a.begin())

using namespace std;

#ifdef ONPC
mt19937 rnd(223);
#else
mt19937 rnd(chrono::high_resolution_clock::now()
			.time_since_epoch().count());
#endif

#define TIME (clock() * 1.0 / CLOCKS_PER_SEC)

using ll = long long;
using ld = double;

const int maxn = 1e5 + 100, inf = 1e9 + 100;

int N;
bool tkn[105][105];

void rec(int l, int r) {
    if (r - l + 1 == 3) {
        tkn[l+1][r] = 1;
        tkn[l+1][r-1] = 1;
        return;
    }
    else if (l >= r) {
        return ;
    }
    for (int i = l + 1; i <= r - 3; i += 2) {
        tkn[i][l + 2] = 1;
        tkn[i][l + 1] = 1;
    }
    for (int j = l + 1; j <= r - 3; j += 2) {
        tkn[r][j] = 1;
        tkn[r - 1][j] = 1;
    }
    for (int i = r; i >= l + 3; i -= 2) {
        tkn[i][r] = 1;
        tkn[i][r - 1] = 1;
    }
    for (int j = r; j >= l + 3; j -= 2) {
        tkn[l + 2][j] = 1;
        tkn[l + 1][j] = 1;
    }
    rec(l + 3, r - 3);
}

void solve() {
    cin >> N;
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N; j++) {
            tkn[i][j] = 0;
        }
    }
    if ((N + 1) % 2 == 0) {
        int bottom = (N + 1) % 6;
        for (int i = 2; i <= N - bottom; i += 3) {
            for (int j = 1; j <= N; j += 2) {
                tkn[i][j] = 1;
                tkn[i - 1][j] = 1;
            }
        }
        for (int j = 2; j <= N; j += 3) {
            for (int i = N - bottom + 2; i <= N; i++) {
                tkn[i][j] = 1;
                tkn[i][j - 1] = 1;
            }
        }
    }
    else {
        rec(0, N);
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            if (!tkn[i][j]) {
                cout << '.';
            }
            else {
                cout << '#';
            }
        }
        cout << "\n";
    }
}

int main() {
#ifdef ONPC
    freopen("../a.in", "r", stdin);
//    freopen("../a.out", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed;
    cout.precision(20);
    int T;
    cin >> T;
    while(T--) {
        solve();
    }
    cerr << "\n\nConsumed " << TIME << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3960kb

input:

4
0 0 o
1 1 c
2 2 p
3 3 c

output:


result:

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