結果
問題 | No.488 四角関係 |
ユーザー | yuppe19 😺 |
提出日時 | 2017-02-24 22:52:59 |
言語 | C++11 (gcc 11.4.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 950 bytes |
コンパイル時間 | 639 ms |
コンパイル使用メモリ | 58,524 KB |
最終ジャッジ日時 | 2023-08-30 23:37:36 |
合計ジャッジ時間 | 1,162 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:3: error: ‘vector’ was not declared in this scope vector<vector<bool>> G(n, vector<bool>(n, false)); // G[n][n] ^~~~~~ main.cpp:9:3: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? main.cpp:4:1: +#include <vector> using namespace std; main.cpp:9:3: vector<vector<bool>> G(n, vector<bool>(n, false)); // G[n][n] ^~~~~~ main.cpp:9:17: error: expected primary-expression before ‘bool’ vector<vector<bool>> G(n, vector<bool>(n, false)); // G[n][n] ^~~~ main.cpp:12:5: error: ‘G’ was not declared in this scope G[a][b] = true; ^ main.cpp:16:17: error: template argument 1 is invalid set<vector<int>> resultSet; ^~ main.cpp:16:17: error: template argument 2 is invalid main.cpp:16:17: error: template argument 3 is invalid main.cpp:27:14: error: ‘G’ was not declared in this scope if(G[a][b] && G[b][c] && G[c][d] && G[d][a] && !G[a][c] && !G[b][d]) { ^ main.cpp:28:20: error: expected primary-expression before ‘int’ vector<int> v = {a, b, c, d}; ^~~ main.cpp:29:24: error: ‘v’ was not declared in this scope sort(begin(v), end(v)); ^ main.cpp:30:23: error: request for member ‘insert’ in ‘resultSet’, which is of non-class type ‘int’ resultSet.insert(v); ^~~~~~ main.cpp:36:23: error: request for member ‘size’ in ‘resultSet’, which is of non-class type ‘int’ int cnt = resultSet.size(); ^~~~
ソースコード
#include <iostream> #include <algorithm> #include <set> using namespace std; using i64 = long long; int main(void) { int n, m; scanf("%d%d", &n, &m); vector<vector<bool>> G(n, vector<bool>(n, false)); // G[n][n] for(int i=0; i<m; ++i) { int a, b; scanf("%d%d", &a, &b); G[a][b] = true; G[b][a] = true; } set<vector<int>> resultSet; for(int a=0; a<n; ++a) { for(int b=0; b<n; ++b) { for(int c=0; c<n; ++c) { for(int d=0; d<n; ++d) { set<int> sett; sett.insert(a); sett.insert(b); sett.insert(c); sett.insert(d); if(sett.size() != 4) { continue; } if(G[a][b] && G[b][c] && G[c][d] && G[d][a] && !G[a][c] && !G[b][d]) { vector<int> v = {a, b, c, d}; sort(begin(v), end(v)); resultSet.insert(v); } } } } } int cnt = resultSet.size(); printf("%d\n", cnt); return 0; }