結果
問題 | No.479 頂点は要らない |
ユーザー | kakira9618 |
提出日時 | 2017-01-27 23:59:54 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 81 ms / 1,500 ms |
コード長 | 1,898 bytes |
コンパイル時間 | 1,412 ms |
コンパイル使用メモリ | 112,100 KB |
実行使用メモリ | 9,420 KB |
最終ジャッジ日時 | 2023-08-25 11:12:03 |
合計ジャッジ時間 | 4,116 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,384 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,380 KB |
testcase_09 | AC | 1 ms
4,384 KB |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,380 KB |
testcase_12 | AC | 1 ms
4,376 KB |
testcase_13 | AC | 2 ms
4,380 KB |
testcase_14 | AC | 2 ms
4,376 KB |
testcase_15 | AC | 1 ms
4,380 KB |
testcase_16 | AC | 2 ms
4,380 KB |
testcase_17 | AC | 2 ms
4,376 KB |
testcase_18 | AC | 2 ms
4,380 KB |
testcase_19 | AC | 2 ms
4,380 KB |
testcase_20 | AC | 3 ms
4,376 KB |
testcase_21 | AC | 2 ms
4,380 KB |
testcase_22 | AC | 2 ms
4,376 KB |
testcase_23 | AC | 2 ms
4,380 KB |
testcase_24 | AC | 2 ms
4,380 KB |
testcase_25 | AC | 2 ms
4,380 KB |
testcase_26 | AC | 81 ms
9,308 KB |
testcase_27 | AC | 80 ms
9,276 KB |
testcase_28 | AC | 64 ms
9,420 KB |
testcase_29 | AC | 64 ms
6,504 KB |
testcase_30 | AC | 65 ms
6,480 KB |
testcase_31 | AC | 65 ms
6,832 KB |
testcase_32 | AC | 65 ms
6,512 KB |
testcase_33 | AC | 65 ms
6,868 KB |
testcase_34 | AC | 71 ms
6,816 KB |
testcase_35 | AC | 63 ms
5,476 KB |
testcase_36 | AC | 34 ms
4,472 KB |
testcase_37 | AC | 70 ms
7,312 KB |
testcase_38 | AC | 60 ms
6,336 KB |
testcase_39 | AC | 42 ms
5,912 KB |
testcase_40 | AC | 51 ms
7,320 KB |
ソースコード
#include <map> #include <set> #include <list> #include <cmath> #include <queue> #include <stack> #include <cstdio> #include <string> #include <vector> #include <complex> #include <cstdlib> #include <cstring> #include <numeric> #include <sstream> #include <iostream> #include <algorithm> #include <functional> #define mp make_pair #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<vb> vvb; typedef vector<vi> vvi; typedef pair<int,int> pii; const int INF=1<<29; const double EPS=1e-9; const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1}; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/tag_and_trait.hpp> typedef __gnu_pbds::tree<int, __gnu_pbds::null_type, less<int>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update> Tree; int flags[100000] = {0}; int main() { int n, m; cin >> n >> m; vector<vector<int> > E(n, vector<int>()); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; E[a].push_back(b); E[b].push_back(a); } string ans = ""; for(int i = n - 1; i >= 0; i--) { bool flag = false; for (int j = 0; j < E[i].size(); j++) { if (E[i][j] > i && !flags[E[i][j]]) { flag = true; break; } } if (flag) { flags[i] = 1; ans += "1"; } else { ans += "0"; } } for (int i = 0; i < ans.size(); i++) { if (ans[i] == '1') { cout << ans.substr(i) << endl; break; } } return 0; }