結果
| 問題 |
No.3232 Not Tic Tac Toe
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-09 16:54:14 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 2,848 bytes |
| コンパイル時間 | 5,426 ms |
| コンパイル使用メモリ | 334,988 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-09 16:54:22 |
| 合計ジャッジ時間 | 8,008 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#include <iostream>
template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {return os<<'(' <<p.first<<", "<<p.second<<')';}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {os<<'[';for(auto it=v.begin();it!=v.end();++it){os<<*it; if(next(it)!=v.end()){os<<", ";}}return os<<']';}
template <typename T>
ostream& operator<<(ostream& os, const vector<vector<T>>& vv) {os<<"[\n";for(auto it=vv.begin();it!=vv.end();++it){os<<" "<<*it;if(next(it)!=vv.end()){os<<",\n";}else{os<<"\n";}}return os<<"]";}
#define dump(x) cerr << #x << " = " << (x) << '\n'
#else
#define dump(x) (void)0
#endif
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
template<class T> using pq = priority_queue<T>;
template<class T> using pq_g = priority_queue<T, vector<T>, greater<T>>;
#define out(x) cout<<x<<'\n'
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define OVERLOAD_REP(_1,_2,_3,name,...) name
#define REP1(i,n) for (auto i = std::decay_t<decltype(n)>{}; (i) != (n); ++(i))
#define REP2(i, l, r) for (auto i = (l); (i) != (r); ++(i))
#define rep(...) OVERLOAD_REP(__VA_ARGS__, REP2, REP1)(__VA_ARGS__)
template<class T> inline bool chmin(T& a, T b) {if(a > b){a = b; return true;} else {return false;}};
template<class T> inline bool chmax(T& a, T b) {if(a < b){a = b; return true;} else {return false;}};
const ll INF=(1LL<<60);
const ll mod=998244353;
using Graph = vector<vector<ll>>;
using Network = vector<vector<pair<ll,ll>>>;
using Grid = vector<string>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dx2[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy2[8] = {1, 0, -1, 1, -1, 1, 0, -1};
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
int H,W;
cin>>H>>W;
if (H == 1 && W == 1) {
cout << "O\n";
return 0;
}
if (H == 2 && W == 2) {
cout << "OO\nOO\n";
return 0;
}
if (H == 3 && W == 6) {
cout << "XXOXOX\nOOXXOX\nXOXOXO\n";
return 0;
}
vector<char> a(W), b(W);
for (int x=0; x<W; ++x) {
a[x] = (x&1) ? 'X' : 'O';
b[x] = (x&1) ? 'O' : 'X';
}
auto* rb = cout.rdbuf();
int q = H/4, r = H%4;
while (q--) {
rb->sputn(a.data(), W); rb->sputc('\n');
rb->sputn(a.data(), W); rb->sputc('\n');
rb->sputn(b.data(), W); rb->sputc('\n');
rb->sputn(b.data(), W); rb->sputc('\n');
}
if (r>=1) { rb->sputn(a.data(), W); rb->sputc('\n'); }
if (r>=2) { rb->sputn(a.data(), W); rb->sputc('\n'); }
if (r>=3) { rb->sputn(b.data(), W); rb->sputc('\n'); }
return 0;
}