結果
問題 | No.606 カラフルタイル |
ユーザー |
|
提出日時 | 2020-08-19 00:03:09 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,121 bytes |
コンパイル時間 | 2,388 ms |
コンパイル使用メモリ | 95,312 KB |
最終ジャッジ日時 | 2025-01-13 03:33:54 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、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.4.0/include/c++/12/string:47, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/bits/locale_classes.h:40, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/bits/ios_base.h:41, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/ios:42, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/ostream:38, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/iostream:39, from main.cpp:1: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/bits/stl_iterator.h: In instantiation of 'constexpr __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.4.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.4.0/include/c++/12/vector:64, from main.cpp:3: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/bits/stl_vector.h: In instantiation of 'constexpr std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]': /ho
ソースコード
#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;}