QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#665660 | #9484. Colored Complete Graph | Kevin5307 | AC ✓ | 248ms | 24264kb | C++23 | 3.8kb | 2024-10-22 14:38:27 | 2024-10-22 14:39:11 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int fa1[50005],fa2[50005];
set<pii> st1[50005],st2[50005];
set<int> nd1[50005],nd2[50005];
int n1[50005],n2[50005];
int siz1[50005],siz2[50005];
inline int anc1(int x)
{
while(fa1[x]!=x) x=fa1[x]=fa1[fa1[x]];
return x;
}
inline int anc2(int x)
{
while(fa2[x]!=x) x=fa2[x]=fa2[fa2[x]];
return x;
}
vector<pii> E1,E2;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int N;
cin>>N;
for(int i=1;i<=N;i++)
{
fa1[i]=fa2[i]=i;
st1[i].emplace(i,i);
st2[i].emplace(i,i);
n1[i]=n2[i]=1;
siz1[i]=siz2[i]=1;
nd1[i].insert(i);
nd2[i].insert(i);
}
pair<pii,int> pr=mp(mp(1,1),1);
while(sz(E1)<N-1&&sz(E2)<N-1)
{
int c=pr.second;
int x=pr.first.second;
if(c==1)
{
pii pr1=*st1[x].begin();
pii pr2=*st1[x].rbegin();
while(anc1(n1[x])==x) n1[x]++;
int a=n1[x];
int b;
if(anc2(pr1.second)==anc2(a))
b=pr2.second;
else
b=pr1.second;
cout<<"? "<<a<<" "<<b<<endl;
char ch;
cin>>ch;
if(ch=='R')
{
E1.pb(a,b);
a=anc1(a);
b=anc1(b);
if(siz1[a]>siz1[b]) swap(a,b);
fa1[a]=b;
siz1[b]+=siz1[a];
pr=max(pr,mp(mp(siz1[b],b),1));
for(auto x:nd1[a])
{
nd1[b].insert(x);
int y=anc2(x);
st2[y].erase(mp(a,x));
st2[y].insert(mp(b,x));
}
for(auto pr:st1[a])
st1[b].insert(pr);
st1[a].clear();
nd1[a].clear();
}
else
{
E2.pb(a,b);
a=anc2(a);
b=anc2(b);
if(siz2[a]>siz2[b]) swap(a,b);
fa2[a]=b;
siz2[b]+=siz2[a];
pr=max(pr,mp(mp(siz2[b],b),2));
for(auto x:nd2[a])
{
nd2[b].insert(x);
int y=anc1(x);
st1[y].erase(mp(a,x));
st1[y].insert(mp(b,x));
}
for(auto pr:st2[a])
st2[b].insert(pr);
st2[a].clear();
nd2[a].clear();
}
}
else
{
pii pr1=*st2[x].begin();
pii pr2=*st2[x].rbegin();
while(anc2(n2[x])==x) n2[x]++;
int a=n2[x];
int b;
if(anc1(pr1.second)==anc1(a))
b=pr2.second;
else
b=pr1.second;
cout<<"? "<<a<<" "<<b<<endl;
char ch;
cin>>ch;
if(ch=='R')
{
E1.pb(a,b);
a=anc1(a);
b=anc1(b);
if(siz1[a]>siz1[b]) swap(a,b);
fa1[a]=b;
siz1[b]+=siz1[a];
pr=max(pr,mp(mp(siz1[b],b),1));
for(auto x:nd1[a])
{
nd1[b].insert(x);
int y=anc2(x);
st2[y].erase(mp(a,x));
st2[y].insert(mp(b,x));
}
for(auto pr:st1[a])
st1[b].insert(pr);
st1[a].clear();
nd1[a].clear();
}
else
{
E2.pb(a,b);
a=anc2(a);
b=anc2(b);
if(siz2[a]>siz2[b]) swap(a,b);
fa2[a]=b;
siz2[b]+=siz2[a];
pr=max(pr,mp(mp(siz2[b],b),2));
for(auto x:nd2[a])
{
nd2[b].insert(x);
int y=anc1(x);
st1[y].erase(mp(a,x));
st1[y].insert(mp(b,x));
}
for(auto pr:st2[a])
st2[b].insert(pr);
st2[a].clear();
nd2[a].clear();
}
}
}
if(sz(E1)==N-1)
{
cout<<"!"<<endl;
for(auto pr:E1)
cout<<pr.first<<" "<<pr.second<<endl;
}
else
{
cout<<"!"<<endl;
for(auto pr:E2)
cout<<pr.first<<" "<<pr.second<<endl;
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 13880kb
input:
3 B R B
output:
? 2 1 ? 3 1 ? 3 2 ! 2 1 3 2
result:
ok AC
Test #2:
score: 0
Accepted
time: 0ms
memory: 13208kb
input:
983 B R R B B B B B R B R R R R R R R B B R R B R B R R B B R B R R R R B R B B B R R R B B R R B R B R B B B R B R R B R B B R R R B B B B R B R R B R B B R B R B R B R R R B B B R R B B B R R B R B B B R B B R R B B R R R R B R R B B B R B B B B R B R R B R R R B R R B R R B R R B R B R B B R B R ...
output:
? 2 1 ? 3 1 ? 3 2 ? 4 1 ? 3 4 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 8 7 ? 9 1 ? 9 7 ? 9 6 ? 9 5 ? 9 4 ? 10 1 ? 11 1 ? 12 1 ? 12 11 ? 12 10 ? 13 1 ? 14 1 ? 14 13 ? 15 1 ? 15 13 ? 16 1 ? 17 1 ? 17 16 ? 17 13 ? 18 1 ? 18 13 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 22 21 ? 23 1 ? 23 21 ? 23 20 ? 23 19 ? 24 1 ? 25 1 ? 26 1 ? 2...
result:
ok AC
Test #3:
score: 0
Accepted
time: 4ms
memory: 13036kb
input:
75 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #4:
score: 0
Accepted
time: 3ms
memory: 13900kb
input:
430 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #5:
score: 0
Accepted
time: 7ms
memory: 13044kb
input:
238 B R R B B B B B R B R R R R R R R B B R R B R B R R B B R B R R R R B R B B B R R R B B R R B R B R B B B R B R R B R B B R R R B B B B R B R R B R B B R B R B R B R R R B B B R R B B B R R B R B B B R B B R R B B R R R R B R R B B B R B B B B R B R R B R R R B R R B R R B R R B R B R B B R B R ...
output:
? 2 1 ? 3 1 ? 3 2 ? 4 1 ? 3 4 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 8 7 ? 9 1 ? 9 7 ? 9 6 ? 9 5 ? 9 4 ? 10 1 ? 11 1 ? 12 1 ? 12 11 ? 12 10 ? 13 1 ? 14 1 ? 14 13 ? 15 1 ? 15 13 ? 16 1 ? 17 1 ? 17 16 ? 17 13 ? 18 1 ? 18 13 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 22 21 ? 23 1 ? 23 21 ? 23 20 ? 23 19 ? 24 1 ? 25 1 ? 26 1 ? 2...
result:
ok AC
Test #6:
score: 0
Accepted
time: 0ms
memory: 13044kb
input:
42 R R R R R R R R R R R R R R R R R R R R R R R R R R R R B B B B B B B B B B B B B B B B B B B B B B B B B B B B B R B R B R B R B R B R B R B R B R B R B R B R B
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 30 29 ? 30 28 ? 30 27 ? 30 26 ? 30 25 ? 30 24 ? 30 23 ? 30 22 ? 30 21 ? 30 20 ? 30 19 ? 30 18 ? 30 17 ?...
result:
ok AC
Test #7:
score: 0
Accepted
time: 6ms
memory: 13424kb
input:
759 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #8:
score: 0
Accepted
time: 9ms
memory: 13204kb
input:
389 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #9:
score: 0
Accepted
time: 0ms
memory: 12992kb
input:
47 R R R R R R R B B B B B B B B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B R B
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 9 8 ? 9 7 ? 9 6 ? 9 5 ? 9 4 ? 9 3 ? 2 9 ? 10 1 ? 10 9 ? 11 1 ? 11 9 ? 12 1 ? 12 9 ? 13 1 ? 13 9 ? 14 1 ? 14 9 ? 15 1 ? 15 9 ? 16 1 ? 16 9 ? 17 1 ? 17 9 ? 18 1 ? 18 9 ? 19 1 ? 19 9 ? 20 1 ? 20 9 ? 21 1 ? 21 9 ? 22 1 ? 22 9 ? 23 1 ? 23 9 ? 24 1 ? 24 9 ...
result:
ok AC
Test #10:
score: 0
Accepted
time: 41ms
memory: 16364kb
input:
14657 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #11:
score: 0
Accepted
time: 45ms
memory: 16848kb
input:
15755 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #12:
score: 0
Accepted
time: 84ms
memory: 16820kb
input:
14236 B R R B B B B B R B R R R R R R R B B R R B R B R R B B R B R R R R B R B B B R R R B B R R B R B R B B B R B R R B R B B R R R B B B B R B R R B R B B R B R B R B R R R B B B R R B B B R R B R B B B R B B R R B B R R R R B R R B B B R B B B B R B R R B R R R B R R B R R B R R B R B R B B R B ...
output:
? 2 1 ? 3 1 ? 3 2 ? 4 1 ? 3 4 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 8 7 ? 9 1 ? 9 7 ? 9 6 ? 9 5 ? 9 4 ? 10 1 ? 11 1 ? 12 1 ? 12 11 ? 12 10 ? 13 1 ? 14 1 ? 14 13 ? 15 1 ? 15 13 ? 16 1 ? 17 1 ? 17 16 ? 17 13 ? 18 1 ? 18 13 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 22 21 ? 23 1 ? 23 21 ? 23 20 ? 23 19 ? 24 1 ? 25 1 ? 26 1 ? 2...
result:
ok AC
Test #13:
score: 0
Accepted
time: 56ms
memory: 17984kb
input:
19615 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #14:
score: 0
Accepted
time: 56ms
memory: 19724kb
input:
30668 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #15:
score: 0
Accepted
time: 144ms
memory: 21724kb
input:
39166 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #16:
score: 0
Accepted
time: 76ms
memory: 20964kb
input:
35168 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #17:
score: 0
Accepted
time: 106ms
memory: 22848kb
input:
45420 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #18:
score: 0
Accepted
time: 105ms
memory: 22816kb
input:
45526 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #19:
score: 0
Accepted
time: 130ms
memory: 23424kb
input:
48225 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #20:
score: 0
Accepted
time: 109ms
memory: 21784kb
input:
40451 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #21:
score: 0
Accepted
time: 112ms
memory: 23252kb
input:
47265 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #22:
score: 0
Accepted
time: 102ms
memory: 21836kb
input:
40881 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #23:
score: 0
Accepted
time: 209ms
memory: 23072kb
input:
44327 B R R B B B B B R B R R R R R R R B B R R B R B R R B B R B R R R R B R B B B R R R B B R R B R B R B B B R B R R B R B B R R R B B B B R B R R B R B B R B R B R B R R R B B B R R B B B R R B R B B B R B B R R B B R R R R B R R B B B R B B B B R B R R B R R R B R R B R R B R R B R B R B B R B ...
output:
? 2 1 ? 3 1 ? 3 2 ? 4 1 ? 3 4 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 8 7 ? 9 1 ? 9 7 ? 9 6 ? 9 5 ? 9 4 ? 10 1 ? 11 1 ? 12 1 ? 12 11 ? 12 10 ? 13 1 ? 14 1 ? 14 13 ? 15 1 ? 15 13 ? 16 1 ? 17 1 ? 17 16 ? 17 13 ? 18 1 ? 18 13 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 22 21 ? 23 1 ? 23 21 ? 23 20 ? 23 19 ? 24 1 ? 25 1 ? 26 1 ? 2...
result:
ok AC
Test #24:
score: 0
Accepted
time: 150ms
memory: 23420kb
input:
48093 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #25:
score: 0
Accepted
time: 113ms
memory: 23736kb
input:
49999 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #26:
score: 0
Accepted
time: 215ms
memory: 24196kb
input:
50000 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #27:
score: 0
Accepted
time: 210ms
memory: 24168kb
input:
50000 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #28:
score: 0
Accepted
time: 226ms
memory: 24248kb
input:
49999 B R R B B B B B R B R R R R R R R B B R R B R B R R B B R B R R R R B R B B B R R R B B R R B R B R B B B R B R R B R B B R R R B B B B R B R R B R B B R B R B R B R R R B B B R R B B B R R B R B B B R B B R R B B R R R R B R R B B B R B B B B R B R R B R R R B R R B R R B R R B R B R B B R B ...
output:
? 2 1 ? 3 1 ? 3 2 ? 4 1 ? 3 4 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 8 7 ? 9 1 ? 9 7 ? 9 6 ? 9 5 ? 9 4 ? 10 1 ? 11 1 ? 12 1 ? 12 11 ? 12 10 ? 13 1 ? 14 1 ? 14 13 ? 15 1 ? 15 13 ? 16 1 ? 17 1 ? 17 16 ? 17 13 ? 18 1 ? 18 13 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 22 21 ? 23 1 ? 23 21 ? 23 20 ? 23 19 ? 24 1 ? 25 1 ? 26 1 ? 2...
result:
ok AC
Test #29:
score: 0
Accepted
time: 248ms
memory: 24264kb
input:
50000 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #30:
score: 0
Accepted
time: 4ms
memory: 13964kb
input:
4 B R R B B
output:
? 2 1 ? 3 1 ? 3 2 ? 4 1 ? 3 4 ! 2 1 4 1 3 4
result:
ok AC
Test #31:
score: 0
Accepted
time: 4ms
memory: 13956kb
input:
5 B R R B B B
output:
? 2 1 ? 3 1 ? 3 2 ? 4 1 ? 3 4 ? 5 1 ! 2 1 4 1 3 4 5 1
result:
ok AC
Test #32:
score: 0
Accepted
time: 4ms
memory: 12984kb
input:
6 R R R R B B B B B
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 6 5 ? 6 4 ? 6 3 ? 2 6 ! 6 1 6 5 6 4 6 3 2 6
result:
ok AC
Test #33:
score: 0
Accepted
time: 173ms
memory: 24200kb
input:
50000 B R R B B B B B R B R R R R R R R B B R R B R B R R B B R B R R R R B R B B B R R R B B R R B R B R B B B R B R R B R B B R R R B B B B R B R R B R B B R B R B R B R R R B B B R R B B B R R B R B B B R B B R R B B R R R R B R R B B B R B B B B R B R R B R R R B R R B R R B R R B R B R B B R B ...
output:
? 2 1 ? 3 1 ? 3 2 ? 4 1 ? 3 4 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 8 7 ? 9 1 ? 9 7 ? 9 6 ? 9 5 ? 9 4 ? 10 1 ? 11 1 ? 12 1 ? 12 11 ? 12 10 ? 13 1 ? 14 1 ? 14 13 ? 15 1 ? 15 13 ? 16 1 ? 17 1 ? 17 16 ? 17 13 ? 18 1 ? 18 13 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 22 21 ? 23 1 ? 23 21 ? 23 20 ? 23 19 ? 24 1 ? 25 1 ? 26 1 ? 2...
result:
ok AC
Test #34:
score: 0
Accepted
time: 195ms
memory: 24184kb
input:
50000 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #35:
score: 0
Accepted
time: 139ms
memory: 23804kb
input:
50000 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Test #36:
score: 0
Accepted
time: 103ms
memory: 23772kb
input:
50000 R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ...
output:
? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ? 45 1 ...
result:
ok AC
Extra Test:
score: 0
Extra Test Passed