QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#440619 | #8544. Colorful Graph 2 | w4p3r | WA | 1ms | 3536kb | C++20 | 954b | 2024-06-13 21:19:08 | 2024-06-13 21:19:09 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define N 200010
int n, m;
vector<int>e[N];
int ans[N];
void sol()
{
cin >> n >> m;
for (int i = 1; i <= m; i ++)
{
int u, v;
cin >> u >> v;
e[u].push_back(v);
e[v].push_back(u);
}
for (int i = 0; i < n; i ++)
{
e[i].push_back((i + 1) % n);
e[(i + 1) % n].push_back(i);
}
queue<int>q; ans[0] = 1; q.push(0);
while(!q.empty())
{
int u = q.front(); q.pop();
for (int v : e[u])if(ans[v] == 0)
{
ans[v] = 3 - ans[u]; q.push(v);
}
}
for (int i = 0; i < n; i ++)
{
if (ans[i] == 1) cout << 'R';
if (ans[i] == 2) cout << 'B';
}
cout << '\n';
for (int i = 0; i < n; i ++)e[i].clear(), ans[i] = 0;
}
int main()
{
cin.tie(0); cout.tie(0); ios::sync_with_stdio(0);
sol();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3536kb
input:
3 3 0 4 1 1 3 6 3 0 2 2 4 4 0
output:
RBB
result:
wrong output format Unexpected end of file - token expected (test case 2)