QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#688048#9530. A Game On TreeMu_SilkWA 1ms3580kbC++201.0kb2024-10-29 22:56:092024-10-29 22:56:09

Judging History

This is the latest submission verdict.

  • [2024-10-29 22:56:09]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3580kb
  • [2024-10-29 22:56:09]
  • Submitted

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'