結果
| 問題 |
No.479 頂点は要らない
|
| コンテスト | |
| ユーザー |
kosakkun
|
| 提出日時 | 2017-04-11 18:29:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 164 ms / 1,500 ms |
| コード長 | 1,639 bytes |
| コンパイル時間 | 986 ms |
| コンパイル使用メモリ | 103,828 KB |
| 実行使用メモリ | 18,812 KB |
| 最終ジャッジ日時 | 2024-07-18 09:05:08 |
| 合計ジャッジ時間 | 3,953 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
#include <fstream>
using namespace std;
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define FILL(Itr,n) fill((Itr).begin(),(Itr).end(),n)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
int n,m;
set< pair<int,int> > edge;
vector<int> G[100010];
bool used[100010];
int main(){
cin >> n >> m;
REP(i,m){
int a,b; cin >> a >> b;
edge.insert(make_pair(a,b));
edge.insert(make_pair(b,a));
G[a].push_back(b);
G[b].push_back(a);
}
REP(i,100010) used[i] = false;
string ans;
RREP(i,n){
REP(j,G[i].size()){
if(G[i][j] > i && (!used[G[i][j]])){
if(edge.find(make_pair(i,G[i][j])) != edge.end()){
ans.push_back('1');
used[i] = true;
goto nextf;
}
}
}
ans.push_back('0');
nextf:;
}
while(ans[0] == '0') ans.erase(ans.begin());
cout << ans << endl;
return 0;
}
kosakkun