QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#688048 | #9530. A Game On Tree | Mu_Silk | WA | 1ms | 3580kb | C++20 | 1.0kb | 2024-10-29 22:56:09 | 2024-10-29 22:56:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<pair<int,int>> p[210];
int cnt=2;
void calc(int l,int r,int cur){
if(l==r){
if(l==1){
p[2].push_back({cur,1});
return;
}
p[cnt+1].push_back({cur,l&1});
cnt++;
calc(l>>1,l>>1,cnt);
return;
}
if((l&1)==1){
calc(l,l,cur);
l++;
}
if((r&1)==0){
calc(r,r,cnt);
r--;
}
if(r>l){
p[cnt+1].push_back({cur,1});
p[cnt+1].push_back({cur,0});
cnt++;
calc(l>>1,r>>1,cnt);
}
}
void solve(){
ll l,r;cin>>l>>r;
calc(l,r,1);
cout<<cnt<<"\n";
for(int i=1;i<=cnt;i++){
cout<<p[i].size()<<" ";
for(auto [j,w]:p[i]){
cout<<j<<" "<<w<<" ";
}
cout<<"\n";
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n=1;
//cin>>n;
while(n--)solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3580kb
input:
2 3 1 2 2 3 5 1 2 1 5 3 2 4 2
output:
3 0 1 3 1 2 1 1 1 0
result:
wrong answer 1st lines differ - expected: '443664158', found: '3'