0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【AtCoder】おすすめのマクロ

Last updated at Posted at 2024-09-16

ポイント

  • 頻度やコード長などを考えて簡略化したい部分をマクロ化する
  • マクロが増え過ぎても混乱するので、ある程度は絞った方が使いやすい

個人的には、long longは型名の途中に空白が入っているのが気持ち悪く感じるからか、一度しか使わない場合でもマクロにしている。

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using P = pair<int, int>;
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)

// マクロの使用例
int main() {
  int N; cin >> N;
  vector<P> L;
  rep(i, N) {
    int v; cin >> v;
    L.emplace_back(v, i);
  }
  sort(all(L));
  
  vector<vi> A(N, vi(N));
  rep(i, N) rep(j, N) cin >> A[i][j];
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?