結果
| 問題 |
No.479 頂点は要らない
|
| ユーザー |
char134217728
|
| 提出日時 | 2017-08-20 03:40:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 1,500 ms |
| コード長 | 822 bytes |
| コンパイル時間 | 1,557 ms |
| コンパイル使用メモリ | 161,144 KB |
| 実行使用メモリ | 9,108 KB |
| 最終ジャッジ日時 | 2024-10-14 16:52:32 |
| 合計ジャッジ時間 | 4,207 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
コンパイルメッセージ
main.cpp:23:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
23 | main(){
| ^~~~
ソースコード
#include <bits/stdc++.h>
#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 pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
const int inf = 1e9;
const int mod = 1e9+7;
int n, m;
vi v[100000];
bool b[100000];
bool must(int a){
for(vi::iterator itr = v[a].begin(); itr != v[a].end(); itr++){
if((!b[*itr]) && (*itr > a)) return true;
}
return false;
}
main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> n >> m;
FOR(i, 0, m){
int a, b;
cin >> a >> b;
v[a].pb(b);
v[b].pb(a);
}
FORR(i, n-1, 0){
b[i] = must(i);
}
bool z = false;
FORR(i, n-1, 0){
if(z || b[i]){
z = true;
cout << (b[i] ? "1" : "0");
}
}
cout << endl;
}
char134217728