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