QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#754793 | #9521. Giving Directions in Harbin | ANIG# | WA | 0ms | 3712kb | C++14 | 1.5kb | 2024-11-16 15:48:57 | 2024-11-16 15:48:57 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int L,R;
int k,idx;
vector<int> rec[1111];
vector<pair<int,int>> ver[1111];
void solve(int l,int r,int dep=0,int now=1){
if(L<=l&&r<=R){
rec[dep].emplace_back(now);
return ;
}
int mid=(l+r)>>1;
if(L<=mid){
if(!l) solve(l,mid,dep+1,now);
else{
idx++;
ver[now].emplace_back(idx,0);
solve(l,mid,dep+1,idx);
}
}
if(mid<R){
idx++;
ver[now].emplace_back(idx,1);
solve(mid+1,r,dep+1,idx);
}
}
int main(){
cin>>L>>R;
int mx=R;
while((mx&-mx)!=mx) mx++;
k=__lg(mx);
cerr<<k<<endl;
solve(0,mx-1);
mx=-1;
for(int i=0; i<1000; i++){
if(rec[i].size()){
mx=i;
break;
}
}
assert(mx!=-1);
int Lim=k-mx;
for(int i=idx+1; i<idx+Lim; i++){
ver[i].emplace_back(i+1,0);
ver[i].emplace_back(i+1,1);
}
for(int i=0; i<1000; i++){
for(auto pt:rec[i]){
ver[pt].emplace_back(k-i,0);
ver[pt].emplace_back(k-i,1);
}
}
int T=0;
for(int i=1; i<1000; i++){
if(ver[i].size()){
T=i;
}
}
for(int i=1; i<=T; i++){
cout<<ver[i].size()<<' ';
for(auto pt:ver[i]){
cout<<pt.first<<' '<<pt.second<<' ';
}
cout<<'\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3712kb
input:
1 2 S 2 E 1
output:
3 1 1 0 0 0 1
result:
wrong answer Token parameter [name=f] equals to "1", doesn't correspond to pattern "[NSWE]" (test case 1)