結果
| 問題 |
No.479 頂点は要らない
|
| ユーザー |
|
| 提出日時 | 2018-03-08 23:01:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 1,500 ms |
| コード長 | 749 bytes |
| コンパイル時間 | 630 ms |
| コンパイル使用メモリ | 74,980 KB |
| 実行使用メモリ | 9,332 KB |
| 最終ジャッジ日時 | 2024-10-05 08:16:59 |
| 合計ジャッジ時間 | 3,664 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
vector<int> roads[n];
for(int i = 0; i < m; i++){
int start, goal;
cin >> start >> goal;
roads[start].push_back(goal);
roads[goal].push_back(start);
}
bool if_choose[n];
fill(if_choose, if_choose + n, false);
string ans;
for(int i = n - 1; i >= 0; i--){
if(!if_choose[i]){
for(int j = 0; j < roads[i].size(); j++){
if_choose[roads[i][j]] = true;
}
if(ans != ""){
ans.push_back('0');
}
}else{
ans.push_back('1');
}
}
cout << ans << endl;
}