Submission #938343

# Submission time Handle Problem Language Result Execution time Memory
938343 2024-03-05T04:56:41 Z vjudge1 One-Way Streets (CEOI17_oneway) C++17
0 / 100
3 ms 12124 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pii pair<int,int>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define f first
#define int long long
#define s second
#define pii pair<int,int>
template<class T>bool umax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>bool umin(T &a,T b){if(b<a){a=b;return true;}return false;}
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
	tree_order_statistics_node_update> ordered_set;
const int N = 3e5 + 5	;
const int inf = 1e17 + 7;
const int mod = 998244353;

int n,m,k,a,b;
vector<int>g[N];
vector<pii>all;
vector<array<int,2>>vs(N);

void dfs(int x, vector<int>vis){
	
	if(x == b){
		int i = 0;
		for(auto to:all){
			if(vis[to.f] - vis[to.s] == 1){
				vs[i][0] = 1;
			}
			if(vis[to.s] - vis[to.f] == 1){
				vs[i][1] = 1;
			}
			i += 1;
		}
	}
	
	for(auto to:g[x]){
		if(vis[to] > vis[x] + 1){
			vis[to] = vis[x] + 1;
			dfs(to,vis);
		}
	}
}

void solve(){
	
	cin>>n>>m;
	
	while(m--){
		cin>>a>>b;
		g[a].pb(b);
		g[b].pb(a);
		all.pb({a,b});
	}
	int q;
	cin>>q;
	
	while(q--){
		cin>>a>>b;
		vector<int>vis(n+1,inf);
		vis[a] = 0;
		dfs(a,vis);
	}
	
	for(int i = 0;i<all.size();i++){
		if(vs[i][0] == 1 && vs[i][1] == 1){
			cout<<"B";
		}
		else if(vs[i][0] == 1)cout<<"L";
		else cout<<"R";
	}
	
	
	
	
}

signed main()
{
//	freopen("seq.in", "r", stdin);
//  freopen("seq.out", "w", stdout);
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	int tt=1;//cin>>tt>>n;
	while(tt--)solve();

}

Compilation message

oneway.cpp: In function 'void solve()':
oneway.cpp:70:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |  for(int i = 0;i<all.size();i++){
      |                ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 12124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 12124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 12124 KB Output isn't correct
2 Halted 0 ms 0 KB -