提出 #72683435


ソースコード 拡げる

#include <bits/stdc++.h>

//#include <atcoder/all>
using namespace std;

#define lli long long int
#define REP(i, s, n) for (lli i = s; i < n; i++)
#define INF (1LL << 62)
#define mp(a, b) make_pair(a, b)
#define SORT(V) sort(V.begin(), V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) #VariableName
#define LOG1(x)                                                                \
  if (DEBUG)                                                                   \
    cout << TO_STRING(x) << "=" << x << " " << endl;
#define LOG2(x, y)                                                             \
  if (DEBUG)                                                                   \
    cout << TO_STRING(x) << "=" << x << " " << TO_STRING(y) << "=" << y << endl;
#define LOG3(x, y, z)                                                          \
  if (DEBUG)                                                                   \
    cout << TO_STRING(x) << "=" << x << " " << TO_STRING(y) << "=" << y << " " \
         << TO_STRING(z) << "=" << z << endl;
#define LOG4(w, x, y, z)                                                       \
  if (DEBUG)                                                                   \
    cout << TO_STRING(w) << "=" << w << " " << TO_STRING(x) << "=" << x << " " \
         << TO_STRING(y) << "=" << y << " " << TO_STRING(z) << "=" << z        \
         << endl;
#define LOG5(w, x, y, z, a)                                                    \
  if (DEBUG)                                                                   \
    cout << TO_STRING(w) << "=" << w << " " << TO_STRING(x) << "=" << x << " " \
         << TO_STRING(y) << "=" << y << " " << TO_STRING(z) << "=" << z << " " \
         << TO_STRING(a) << "=" << a << endl;
#define LOG6(w, x, y, z, a, b)                                                 \
  if (DEBUG)                                                                   \
    cout << TO_STRING(w) << "=" << w << " " << TO_STRING(x) << "=" << x << " " \
         << TO_STRING(y) << "=" << y << " " << TO_STRING(z) << "=" << z << " " \
         << TO_STRING(a) << "=" << a << " " << TO_STRING(b) << "=" << b        \
         << endl;

#define overload6(a, b, c, d, e, f, g, ...) g
#define LOG(...)                                                               \
  overload6(__VA_ARGS__, LOG6, LOG5, LOG4, LOG3, LOG2, LOG1)(__VA_ARGS__)

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

mt19937 engine;
std::chrono::system_clock::time_point start, endTime;

#define DEBUG 0

void solve() {
  //  write your code here

  lli N, M;
  cin >> N >> M;

  vector<vector<lli>> Graph(N);

  REP(i, 0, M) {
    lli a, b;
    cin >> a >> b;
    a--;
    b--;
    Graph[a].push_back(b);
    Graph[b].push_back(a);
  }

  REP(i, 0, N) {
    lli nowNum = N - 1;
    nowNum -= Graph[i].size();

    if (nowNum <= 2) {
      cout << 0 << " ";
    } else {
      cout << nowNum * (nowNum - 1) * (nowNum - 2) / 6 << " ";
    }
  }
  cout << endl;
}

// Generated by 2.13.0 https://github.com/kyuridenamida/atcoder-tools  (tips:
// You use the default template now. You can remove this line by using your
// custom template)
int main() {
  // Failed to predict input format

  lli N = 1;
  // cin >> N;
  while (N--)
    solve();

  return 0;
}

提出情報

提出日時
問題 C - Peer Review
ユーザ ohuton_labo
言語 C++23 (GCC 15.2.0)
得点 300
コード長 3573 Byte
結果 AC
実行時間 133 ms
メモリ 15708 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 25
セット名 テストケース
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt
ケース名 結果 実行時間 メモリ
sample00.txt AC 1 ms 3588 KiB
sample01.txt AC 1 ms 3416 KiB
sample02.txt AC 1 ms 3536 KiB
testcase00.txt AC 1 ms 3484 KiB
testcase01.txt AC 14 ms 8576 KiB
testcase02.txt AC 82 ms 11596 KiB
testcase03.txt AC 57 ms 9284 KiB
testcase04.txt AC 60 ms 8260 KiB
testcase05.txt AC 54 ms 9160 KiB
testcase06.txt AC 25 ms 9500 KiB
testcase07.txt AC 133 ms 15708 KiB
testcase08.txt AC 53 ms 8964 KiB
testcase09.txt AC 53 ms 8824 KiB
testcase10.txt AC 4 ms 4000 KiB
testcase11.txt AC 54 ms 9012 KiB
testcase12.txt AC 52 ms 9592 KiB
testcase13.txt AC 54 ms 8784 KiB
testcase14.txt AC 26 ms 5916 KiB
testcase15.txt AC 55 ms 8812 KiB
testcase16.txt AC 19 ms 4844 KiB
testcase17.txt AC 56 ms 8908 KiB
testcase18.txt AC 41 ms 6864 KiB
testcase19.txt AC 31 ms 6480 KiB
testcase20.txt AC 56 ms 8264 KiB
testcase21.txt AC 91 ms 13568 KiB