結果
| 問題 | No.3728 Half and Half, and Double |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-19 16:19:44 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 3 ms / 2,000 ms |
| + 180µs | |
| コード長 | 1,032 bytes |
| 記録 | |
| コンパイル時間 | 2,513 ms |
| コンパイル使用メモリ | 356,712 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-19 16:19:52 |
| 合計ジャッジ時間 | 5,095 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
//start here
int N;cin >> N;
N *= 2;
if(N == 2){
cout << "-1";
return 0;
}
else if(N == 4){
cout << "-1";
return 0;
}
vector<string> grid(N,string(N,'A'));
int cnt = N*N/2;
auto add = [&](int i,int j){
if(cnt == 0) return;
if(grid[i][j] == 'B') return;
if((i == 1 || i == 2) && (j == 2 || j == 4)) return;
cnt--;
grid[i][j] = 'B';
};
for(int i = 1;i < N-1;i++){
add(1,i);
add(i,1);
}
for(int i = 1;i < N-1;i++){
for(int j = 1;j < N-1;j++){
add(i,j);
}
}
if(N == 6){
// cout << "-1";
grid = vector<string>{
"AAAAAA",
"ABBBBA",
"ABBBBB",
"ABBBBB",
"AABBBB",
"AAAAAA",
};
}
for(auto &i:grid){
cout << i << '\n';
}
}