結果
| 問題 |
No.1988 Divisor Tiling
|
| コンテスト | |
| ユーザー |
Rubikun
|
| 提出日時 | 2024-07-20 18:50:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 1,653 bytes |
| コンパイル時間 | 3,869 ms |
| コンパイル使用メモリ | 202,436 KB |
| 最終ジャッジ日時 | 2025-02-23 17:18:14 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
ll N,H;cin>>N>>H;
vector<ll> AA={6,28,496,8128},BB={3,7,31,127};
for(ll q=0;q<4;q++){
if(AA[q]!=N) continue;
ll A=AA[q],B=BB[q];
bool fl=false;
if(H%B==0){
H=N/H;
fl=true;
}
ll W=N/H;
vector<vector<ll>> ans;
for(ll x=W;x<N;x*=2){
for(int i=0;i<x/W;i++){
ans.push_back(vector<ll>(W,x));
}
}
vector<ll> S;
for(ll x=1;x<B;x*=2){
for(int j=0;j<x;j++) S.push_back(x);
}
for(ll x=B;x<W;x*=2){
for(int j=0;j<x;j++) S.push_back(x);
}
ans.push_back(S);
if(!fl){
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cout<<ans[i][j]<<" ";
}
cout<<"\n";
}
}else{
for(int j=0;j<W;j++){
for(int i=0;i<H;i++){
cout<<ans[i][j]<<" ";
}
cout<<"\n";
}
}
}
}
Rubikun