結果

問題 No.606 カラフルタイル
ユーザー MisterMister
提出日時 2020-08-19 00:03:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,121 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 70,080 KB
最終ジャッジ日時 2024-10-12 03:24:53
合計ジャッジ時間 2,005 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In function 'void solve()':
main.cpp:12:16: error: structured binding refers to incomplete type 'std::tuple<int, int, int>'
   12 |     for (auto& [t, x, c] : ts) {
      |                ^~~~~~~~~
main.cpp:24:15: error: 'std::tuple<int, int, int> <structured bindings>' has incomplete type
   24 |     for (auto [t, x, c] : ts) {
      |               ^~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/string:47,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/locale_classes.h:40,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/ios_base.h:41,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ios:42,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:38,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/iostream:39,
                 from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_iterator.h: In instantiation of '__gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = std::tuple<int, int, int>*; _Container = std::vector<std::tuple<int, int, int> >]':
main.cpp:12:28:   required from here
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_iterator.h:1107:11: error: cannot increment a pointer to incomplete type 'std::tuple<int, int, int>'
 1107 |         ++_M_current;
      |           ^~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/vector:64,
                 from main.cpp:3:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]':
/home/linuxbrew/.linuxb

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>

using lint = long long;

void solve() {
    int n, k, m;
    std::cin >> n >> k >> m;

    std::vector<std::tuple<int, int, int>> ts(m);
    for (auto& [t, x, c] : ts) {
        char tc;
        std::cin >> tc >> x >> c;
        t = (tc == 'C');
        --x, --c;
    }
    std::reverse(ts.begin(), ts.end());

    std::vector<bool> rows(n, false), cols(n, false);
    int rnum = n, cnum = n;
    std::vector<lint> ans(k, 0);

    for (auto [t, x, c] : ts) {
        switch (t) {
            case 0: {
                if (rows[x]) continue;
                ans[c] += cnum;
                rows[x] = true;
                --rnum;
                break;
            }
            case 1: {
                if (cols[x]) continue;
                ans[c] += rnum;
                cols[x] = true;
                --cnum;
                break;
            }
        }
    }
    ans[0] += lint(rnum) * cnum;

    for (auto a : ans) std::cout << a << "\n";
}

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

    solve();

    return 0;
}
0