cpp_library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub toyama1710/cpp_library

:heavy_check_mark: test/aoj/IPT1_6_C.test.cpp

Depends on

Code

#define PROBLEM \
    "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C"

#include <iostream>

#include "../../util/make_vector.hpp"

#define _overload(_1, _2, _3, _4, name, ...) name
#define _rep1(Itr, N) _rep3(Itr, 0, N, 1)
#define _rep2(Itr, a, b) _rep3(Itr, a, b, 1)
#define _rep3(Itr, a, b, step) for (i64 Itr = a; Itr < b; Itr += step)
#define repeat(...) _overload(__VA_ARGS__, _rep3, _rep2, _rep1)(__VA_ARGS__)
#define rep(...) repeat(__VA_ARGS__)

#define ALL(X) begin(X), end(X)

using namespace std;
using i64 = long long;
using u64 = unsigned long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    auto room = make_vector({4, 3, 10}, 0);

    i64 n;
    cin >> n;
    rep(_, n) {
        i64 b, f, r, v;
        cin >> b >> f >> r >> v;
        --b, --f, --r;
        room[b][f][r] += v;
    }

    rep(i, 4) {
        rep(j, 3) {
            rep(k, 10) cout << ' ' << room[i][j][k];
            cout << endl;
        }
        if (i < 3) {
            rep(i, 20) cout << '#';
            cout << endl;
        }
    }

    return 0;
}
#line 1 "test/aoj/IPT1_6_C.test.cpp"
#define PROBLEM \
    "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C"

#include <iostream>

#line 1 "util/make_vector.hpp"



#include <cassert>
#include <cstdint>
#include <vector>

template <class T, uint64_t N>
auto make_vector_(const uint64_t *dim, T e) {
    if constexpr (N == 1) {
        return std::vector<T>(*dim, e);
    } else {
        auto v = make_vector_<T, N - 1>(dim + 1, e);
        return std::vector<decltype(v)>(*dim, v);
    }
};
template <class T, uint64_t N>
auto make_vector(const uint64_t (&dim)[N], const T &e) {
    assert(N > 0);
    return make_vector_<T, N>(dim, e);
};


#line 7 "test/aoj/IPT1_6_C.test.cpp"

#define _overload(_1, _2, _3, _4, name, ...) name
#define _rep1(Itr, N) _rep3(Itr, 0, N, 1)
#define _rep2(Itr, a, b) _rep3(Itr, a, b, 1)
#define _rep3(Itr, a, b, step) for (i64 Itr = a; Itr < b; Itr += step)
#define repeat(...) _overload(__VA_ARGS__, _rep3, _rep2, _rep1)(__VA_ARGS__)
#define rep(...) repeat(__VA_ARGS__)

#define ALL(X) begin(X), end(X)

using namespace std;
using i64 = long long;
using u64 = unsigned long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    auto room = make_vector({4, 3, 10}, 0);

    i64 n;
    cin >> n;
    rep(_, n) {
        i64 b, f, r, v;
        cin >> b >> f >> r >> v;
        --b, --f, --r;
        room[b][f][r] += v;
    }

    rep(i, 4) {
        rep(j, 3) {
            rep(k, 10) cout << ' ' << room[i][j][k];
            cout << endl;
        }
        if (i < 3) {
            rep(i, 20) cout << '#';
            cout << endl;
        }
    }

    return 0;
}
Back to top page