답안 #285977

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
285977 2020-08-29T20:12:01 Z Blagojce One-Way Streets (CEOI17_oneway) C++11
0 / 100
6 ms 5248 KB
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const ll inf = 1e18;
const ld eps = 1e-13;
const ll mod = 1e9+7; 
const int i_inf = 1e9;
const int mxn = 1e5;
mt19937 _rand(time(NULL));
clock_t timer = clock();

int n, m;
vector<pii> g[mxn];
int ans[mxn];
int dep[mxn];
bool vis[mxn];
bool bridge[mxn];


void dfs0(int u, int ed){
	vis[u] = true;
	int mindepth = dep[u];
	for(auto e : g[u]){
		if(e.nd == ed) continue;
		if(!vis[e.st]){
			dep[e.st] = dep[u] + 1;
			dfs0(e.st, e.nd);
		}
		mindepth = min(mindepth, dep[e.st]);
	}
	if(mindepth < dep[u]){
		bridge[ed] = true;
		dep[u] = mindepth;
	}
}

void solve(){
	cin >> n >> m;
	fr(i, 0, m){
		int u, v;
		cin >> u >> v;
		--u, --v;
		if(u == v){
			continue;
		}
		g[u].pb({v, i});
		g[v].pb({u, i});
	}
	dfs0(0, -1);
	fr(i, 0, n){
		if(!vis[i]){
			cout<<2/0<<endl;
			return;
		}
	}
	
	
	fr(i, 0, m){
		cout<<"B";
	}
	cout<<endl;
	
}

int main(){
	solve();
}
	

Compilation message

oneway.cpp: In function 'void solve()':
oneway.cpp:62:11: warning: division by zero [-Wdiv-by-zero]
   62 |    cout<<2/0<<endl;
      |          ~^~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 5248 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 5248 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 5248 KB Execution killed with signal 4
2 Halted 0 ms 0 KB -