結果
問題 | No.479 頂点は要らない |
ユーザー |
![]() |
提出日時 | 2017-01-27 22:55:16 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 73 ms / 1,500 ms |
コード長 | 835 bytes |
コンパイル時間 | 2,020 ms |
コンパイル使用メモリ | 167,152 KB |
実行使用メモリ | 5,472 KB |
最終ジャッジ日時 | 2024-12-23 16:40:15 |
合計ジャッジ時間 | 3,893 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include <bits/stdc++.h>#define rep(i, a, n) for(int i = a; i < n; i++)#define repb(i, a, b) for(int i = a; i >= b; i--)#define all(a) a.begin(), a.end()#define o(a) cout << a << endl#define int long longusing namespace std;typedef pair<int, int> P;signed main(){int n, m;cin >> n >> m;vector<bool> f(n, false);vector<P> d;rep(i, 0, m){int a, b;cin >> a >> b;if(a < b) swap(a, b);d. push_back(P(a, b));}sort(all(d));reverse(all(d));rep(i, 0, d.size()){if(f[d[i].first] || f[d[i].second]) continue;f[d[i].second] = true;}string s = "";repb(i, n - 1, 0){if(s == "" && f[i] == false) continue;else{if(f[i]) s += "1";else s += "0";}}cout << s << endl;}