結果

問題 No.2112 All 2x2 are Equal
ユーザー butsurizuki
提出日時 2022-10-28 21:46:27
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 2,927 ms
コンパイル使用メモリ 245,728 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-06 00:52:20
合計ジャッジ時間 7,850 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 11 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

vector<int> gen(int l){
  vector<int> res(l);
  int cur;

  cur=0;
  for(int i=0;i<l;i+=2){res[i]=cur;cur++;}

  cur=l-1;
  for(int i=1;i<l;i+=2){res[i]=cur;cur--;}

  return res;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << "Yes\n";

  int n,m;
  cin >> n >> m;
  vector<int> h=gen(n);
  vector<int> v=gen(m);
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      if(j){cout << " ";}

      int ti=i,tj=j;
      if(i%2){tj=m-1-tj;}
      if(j%2){ti=n-1-ti;}
      // cout << h[ti] << " " << v[tj] << " ";
      cout << h[ti]*m+v[tj]+1;
    }cout << "\n";
  }
  return 0;
}
0