結果
| 問題 | No.3728 Half and Half, and Double |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-19 14:43:21 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 4 ms / 2,000 ms |
| + 375µs | |
| コード長 | 1,836 bytes |
| 記録 | |
| コンパイル時間 | 1,851 ms |
| コンパイル使用メモリ | 339,708 KB |
| 実行使用メモリ | 10,032 KB |
| 最終ジャッジ日時 | 2026-09-19 14:43:40 |
| 合計ジャッジ時間 | 5,369 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,g,n) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define eb emplace_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<typename T> using pq = priority_queue<T,vector<T>,greater<T>>;
using P = pair<int,int>;
template<class T>bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,T b){if(b<a){a=b;return 1;}return 0;}
int main() {
int n;
cin >> n;
if (n <= 4) {
if (n == 1) {
cout << -1 << endl;
} else if (n == 2) {
cout << -1 << endl;
} else if (n == 3) {
cout << "AAAAAA" << endl;
cout << "BBBBAA" << endl;
cout << "BBBBBA" << endl;
cout << "BBBBBA" << endl;
cout << "ABBBBA" << endl;
cout << "AAAAAA" << endl;
} else if (n == 4) {
cout << "AAAAAAAA" << endl;
cout << "ABBBBBBA" << endl;
cout << "AABBBBBA" << endl;
cout << "ABBBBBBA" << endl;
cout << "AABBBBBA" << endl;
cout << "ABBBBBBA" << endl;
cout << "ABABABBA" << endl;
cout << "AAAAAAAA" << endl;
}
return 0;
}
vector<string> s(2*n, string(2*n, 'A'));
rep(i,1,2*n-2) rep(j,1,2*n-2) s[i][j] = 'B';
s[0][0] = s[0][1] = s[1][0] = 'B';
// rep(i,0,2*n) cout << s[i] << endl;
int x = (2*n-3)*(2*n-3)+3;
// int y = (2*n-4)*(2*n-3)/2;
// cout << x-y << " " << 2*n*n << " " << y << endl;
rep(i,0,2*n-4) {
rep(j,0,2*n-4-i) {
if (x > 2*n*n) {
s[j+1][2*n-i-3] = 'A';
--x;
}
}
}
rep(i,0,2*n) cout << s[i] << endl;
return 0;
}