結果
問題 | No.479 頂点は要らない |
ユーザー | TangentDay |
提出日時 | 2017-01-27 22:41:41 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 74 ms / 1,500 ms |
コード長 | 1,090 bytes |
コンパイル時間 | 900 ms |
コンパイル使用メモリ | 88,960 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 16:28:16 |
合計ジャッジ時間 | 3,581 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include <iostream> #include <fstream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> using namespace std; #define REP(i,n) for(int i=0; i<n; ++i) #define FOR(i,a,b) for(int i=a; i<=b; ++i) #define FORR(i,a,b) for (int i=a; i>=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<VI> VVI; typedef pair<int,int> P; typedef pair<ll,ll> PL; int main() { int n, m; cin >> n >> m; VI ans(n); vector<P> e(m); REP(i,m){ int x, y; cin >> x >> y; e[i].first = min(x,y); e[i].second = max(x,y); } sort(ALL(e)); FORR(i,m-1,0){ if (ans[e[i].first] || ans[e[i].second]) continue; ans[e[i].first] = 1; } bool f = 0; FORR(i,n-1,0){ if (f) cout << ans[i]; else{ if (ans[i]){ cout << ans[i]; f = 1; } } } return 0; }