結果

問題 No.3649 Top View of Jenga
コンテスト
ユーザー tAbErU
提出日時 2026-08-28 21:37:42
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 657µs
コード長 1,781 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,075 ms
コンパイル使用メモリ 330,716 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-28 21:38:34
合計ジャッジ時間 3,591 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
using namespace std;
ll INF = 1LL<<60;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define nfor(i,s,n) for(int i=s;i<n;++i)
#define dfor(i,s,n) for(ll i=(s)-1;i>=n;--i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pop_cnt(s) ll(popcount(uint64_t(s)))
#define next_p(v) next_permutation(all(v))
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define yn(ans) cout << (ans ? "Yes" : "No") << "\n"
#define YN(ans) cout << (ans ? "YES" : "NO") << "\n"
#define fix(n) fixed<<setprecision((int)(n))
using P = pair<ll,ll>;
template<class T> using pq = priority_queue<T,vector<T>>;
template<class T> using pq_g = priority_queue<T,vector<T>,greater<T>>;
template<typename T> using vc = vector<T>;
template<typename T> using vv = vc<vc<T>>;
template<typename T> using vvv = vv<vc<T>>;
template<class T>istream& operator>>(istream& i,vc<T>& v){ rep(j, size(v))i>>v[j]; return i; }


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;cin>>n;
  ll tekazu=n/3;
  ll a[3][3];
  rep(i,3){
    rep(j,3){
      a[i][j]=tekazu;
    }
  }
  ll amari=n%3;
  if(amari!=0&&(tekazu+1)%2==0){
    rep(i,amari){
      a[i][0]++;
      a[i][1]++;
      a[i][2]++;
    }
  }else if(amari!=0&&(tekazu+1)%2!=0){
    rep(i,amari){
      a[0][i]++;
      a[1][i]++;
      a[2][i]++;
    }
  }
  rep(i,3){
    rep(j,3){
      cout<<a[i][j]<<" \n"[j==2];
    }
  }
}
0