結果
問題 | No.479 頂点は要らない |
ユーザー |
|
提出日時 | 2017-01-27 23:42:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 593 bytes |
コンパイル時間 | 319 ms |
コンパイル使用メモリ | 52,312 KB |
最終ジャッジ日時 | 2024-11-14 19:55:48 |
合計ジャッジ時間 | 844 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:3: error: ‘vector’ was not declared in this scope 8 | vector<vector<int>> G(n, vector<int>()); // G[n][] | ^~~~~~ main.cpp:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 2 | #include <algorithm> +++ |+#include <vector> 3 | using namespace std; main.cpp:8:17: error: expected primary-expression before ‘int’ 8 | vector<vector<int>> G(n, vector<int>()); // G[n][] | ^~~ main.cpp:11:5: error: ‘G’ was not declared in this scope 11 | G[a].push_back(b); | ^ main.cpp:17:17: error: ‘G’ was not declared in this scope 17 | for(int u : G[i]) { | ^ main.cpp:7:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | int n, m; scanf("%d%d", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:10:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | int a, b; scanf("%d%d", &a, &b); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <iostream>#include <algorithm>using namespace std;using i64 = long long;int main(void) {int n, m; scanf("%d%d", &n, &m);vector<vector<int>> G(n, vector<int>()); // G[n][]for(int i=0; i<m; ++i) {int a, b; scanf("%d%d", &a, &b);G[a].push_back(b);G[b].push_back(a);}string removed(n, '0');for(int i=n-1; i>=0; --i) {if(removed[i] == '1') { continue; }for(int u : G[i]) {removed[u] = '1';}}reverse(begin(removed), end(removed));removed.erase(0, removed.find_first_not_of('0'));cout << removed << endl;return 0;}