Submission #1361890

#TimeUsernameProblemLanguageResultExecution timeMemory
1361890edoMonster-Go (EGOI25_monstergo)C++20
18 / 100
0 ms344 KiB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

// :(
void print_vec(vector<int> v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  for (int x : v)
    cout << x << " ";
  cout << "\n";
}

void solve(int n) {
  if (n <= 4) {
    for (int i = 0, num = 0; i < n; ++i) {
      for (int j = 0; j < 12; ++j)
        cout << num++ << " ";
      cout << "\n";
    }
    return;
  }

  int done = 0;
  int start = 0;

  while (n - done >= 4) {
    vector<int> base(16);
    iota(base.begin(), base.end(), start);

    array<vector<int>, 4> ans;
    for (int who = 0; who < 4; ++who) {
      for (int j = 0; j < 16; ++j) {
        if (j % 4 != who)
          ans[who].push_back(base[j] % 50);
      }
    }

    for (int who = 0; who < 4; ++who)
      print_vec(ans[who]);

    start += 16;
    done += 4;
  }

  while (done < n) {
    vector<int> v;
    for (int i = 0; i < 12; ++i)
      v.push_back((start + i) % 50);
    print_vec(v);
    start += 12;
    done++;
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  solve(n);

  return 0;
}
#Result Execution timeMemoryGrader output
Fetching results...