QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#387775 | #8544. Colorful Graph 2 | ucup-team134# | WA | 78ms | 3796kb | C++17 | 882b | 2024-04-12 20:00:06 | 2024-04-12 20:00:07 |
Judging History
answer
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
int main(){
int t;
scanf("%i",&t);
while(t--){
int n,m;
scanf("%i %i",&n,&m);
vector<bool> col(n);
vector<vector<int>> graf(n);
for(int i=0;i<m;i++){
int a,b;
scanf("%i %i",&a,&b);
graf[a].pb(b);
graf[b].pb(a);
}
for(int i=1;i<n;i++){
int mxIma=-1;
for(auto p:graf[i]){
if(p<i){
mxIma=max(mxIma,p);
}
}
if(mxIma==-1)mxIma=i-1;
col[i]=!col[mxIma];
}
for(int i=0;i<n;i++){
printf(col[i]?"R":"B");
}
printf("\n");
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3796kb
input:
3 3 0 4 1 1 3 6 3 0 2 2 4 4 0
output:
BRB BRBB BRRBBR
result:
ok ok (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 78ms
memory: 3736kb
input:
100000 9 6 2 0 4 6 3 6 0 6 0 7 2 6 3 0 5 2 2 4 2 0 6 3 1 5 4 1 2 4 9 6 3 1 6 4 8 1 3 6 1 6 8 6 3 0 7 4 3 0 4 0 6 4 3 1 7 4 5 1 5 0 3 1 1 4 4 1 1 3 6 3 2 4 4 0 2 0 6 3 3 0 1 3 5 3 7 4 0 5 2 5 5 1 3 5 8 5 4 1 5 1 5 0 1 3 5 7 3 0 8 5 0 2 4 6 0 6 0 3 4 0 8 5 5 1 1 4 5 0 3 1 5 7 3 0 10 7 0 2 9 2 5 8 3 9 ...
output:
BRRBRBBRB BRB BRRBB BRBRRB BRBBRBBRR BRB BRBBRBB BRBBBBR BRBB BRRBBR BRBBRR BRBRBBR BRBBBBRR BRB BRRRRBBR BRBBBBRR BRB BRRBRBRBBB BRBBRBBB BRBRBRBBBB BRBRBRRBRB BRRRBRRRBB BRB BRBRRBB BRBBBB BRRBBBBB BRBB BRRBRRR BRBRBRRRRR BRBRBBR BRBRRBBB BRBBBB BRRBBR BRB BRB BRBBBRRRB BRBRRBB BRBBR BRBRBBRBBB BR...
result:
wrong answer cycle detected (test case 109)