Submission #49348876


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector<vector<ll>> Mat;
#define fi first
#define se second
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);
void yes() { printf("yes\n"); }
void no() { printf("no\n"); }
void Yes() { printf("Yes\n"); }
void No() { printf("No\n"); }
void YES() { printf("YES\n"); }
void NO() { printf("NO\n"); }

int n, a[3];

void solve(int turn, int rest) {
  if (turn == 3) {
    cout << a[0] << " " << a[1] << " " << a[2] << endl;
    return;
  }

  for (int i = 0; i <= rest; i++) {
    a[turn] = i;
    solve(turn + 1, rest - i);
  }
  return;
}

int main() {
  cin >> n;
  solve(0, n);

  return 0;
}

Submission Info

Submission Time
Task B - Tetrahedral Number
User yutas
Language C++ 20 (gcc 12.2)
Score 150
Code Size 931 Byte
Status AC
Exec Time 3 ms
Memory 3568 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 150 / 150
Status
AC × 2
AC × 22
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
random_03.txt AC 1 ms 3444 KiB
random_04.txt AC 1 ms 3368 KiB
random_05.txt AC 1 ms 3424 KiB
random_06.txt AC 1 ms 3388 KiB
random_07.txt AC 1 ms 3368 KiB
random_08.txt AC 1 ms 3408 KiB
random_09.txt AC 1 ms 3388 KiB
random_10.txt AC 1 ms 3568 KiB
random_11.txt AC 1 ms 3472 KiB
random_12.txt AC 1 ms 3344 KiB
random_13.txt AC 1 ms 3460 KiB
random_14.txt AC 2 ms 3480 KiB
random_15.txt AC 2 ms 3412 KiB
random_16.txt AC 2 ms 3404 KiB
random_17.txt AC 2 ms 3552 KiB
random_18.txt AC 2 ms 3428 KiB
random_19.txt AC 3 ms 3428 KiB
random_20.txt AC 2 ms 3548 KiB
random_21.txt AC 3 ms 3484 KiB
random_22.txt AC 3 ms 3416 KiB
sample_01.txt AC 1 ms 3464 KiB
sample_02.txt AC 1 ms 3444 KiB