QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#392000 | #8544. Colorful Graph 2 | Giga_Cronos# | WA | 1ms | 3580kb | C++20 | 999b | 2024-04-17 01:08:15 | 2024-04-17 01:08:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(),(x).end()
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
vi C;
vvi G;
void DFS(int u){
for(auto v:G[u])if(!C[v]){
C[v]=3-C[u];
DFS(v);
}
}
void problem()
{
int n, m;
cin >> n >> m;
C.assign(n,0);
G.assign(n,vi());
for(int i=0;i<n;i++){
G[i].pb({(i+1)%n});
G[(i+1)%n].pb({i});
}
for(int i=0;i<m;i++){
int a,b;cin>>a>>b;
G[a].pb(b);
G[b].pb(a);
}
C[0]=1;
DFS(0);
for(auto a:C){
if(a==1){
cout<<"R";
}else{
cout<<"B";
}
}
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int tc;
cin>>tc;
while(tc--){
problem();
cout<<"\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3580kb
input:
3 3 0 4 1 1 3 6 3 0 2 2 4 4 0
output:
RBR RBRB RBRBRB
result:
wrong answer cycle detected (test case 3)