結果
| 問題 | No.3765 321-avoiding Grid |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2026-10-18 18:06:34 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 3 ms / 1,000 ms |
| + 236µs | |
| コード長 | 1,063 bytes |
| 記録 | |
| コンパイル時間 | 198 ms |
| コンパイル使用メモリ | 53,620 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-10-18 18:06:37 |
| 合計ジャッジ時間 | 2,651 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3765.cc: No.3765 321-avoiding Grid - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 500;
const int MAX_NN = MAX_N * MAX_N;
/* typedef */
/* global variables */
char s[MAX_NN + 4];
/* subroutines */
/* main */
int main() {
int n, a, b, c;
scanf("%d%d%d%d", &n, &a, &b, &c);
int nn = n * n;
if (a >= n) {
fill(s, s + c, '3');
fill(s + c, s + c + a, '1');
fill(s + c + a, s + nn, '2');
}
else if (c >= n) {
fill(s, s + a, '1');
fill(s + a, s + a + c, '3');
fill(s + a + c, s + nn, '2');
}
else { // a < n && c < n
if (a <= c) {
fill(s, s + a, '1');
fill(s + a, s + c, '3');
fill(s + n, s + n + a, '3');
}
else {
fill(s, s + c, '3');
fill(s + c, s + a, '1');
fill(s + n, s + n + c, '1');
}
for (int u = 0; u < nn; u++)
if (! s[u]) s[u] = '2';
}
for (int i = 0; i < nn; i++) {
putchar(s[i]);
if ((i + 1) % n == 0) putchar('\n');
}
return 0;
}
tnakao0123