結果
| 問題 |
No.479 頂点は要らない
|
| コンテスト | |
| ユーザー |
kotamanegi
|
| 提出日時 | 2017-01-27 23:08:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 1,500 ms |
| コード長 | 1,242 bytes |
| コンパイル時間 | 874 ms |
| コンパイル使用メモリ | 86,816 KB |
| 実行使用メモリ | 12,292 KB |
| 最終ジャッジ日時 | 2024-12-23 16:51:30 |
| 合計ジャッジ時間 | 2,833 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONG_INF 8000000000000000000
vector<int> vertex[200000];
int take[200000] = {};
int main() {
int n, m;
cin >> n >> m;
REP(i, m) {
int a, b;
cin >> a >> b;
vertex[a].push_back(b);
vertex[b].push_back(a);
}
bool start_push = false;
for (int i = n-1;i >= 0;--i) {
if (take[i] == false) {
vector<int> hogees;
for (int q = 0;q < vertex[i].size();++q) {
if (take[vertex[i][q]] == false) {
if (vertex[i][q] > i) {
take[i] = true;
goto ok;
}
hogees.push_back(vertex[i][q]);
}
}
REP(q, hogees.size()) {
take[hogees[q]] = true;
}
ok:;
}
if (take[i] == true) {
cout << 1;
start_push = true;
}
else if (start_push == true) cout << 0;
}
return 0;
}
kotamanegi