# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
826750 | jamezzz | Ancient Machine 2 (JOI23_ancient2) | C++17 | 30 ms | 452 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "ancient2.h"
#include <bits/stdc++.h>
using namespace std;
#define pf printf
#define pb push_back
#define sz(x) ((int)x.size())
string Solve(int N){
int know=0;
string ans="";
while(know!=N){
vector<int> a,b;
for(int i=0;i<know;++i){
a.pb(i+1);
b.pb(i+1);
}
int cur=know,num=1;
while(cur+3*num<=1002&&know!=N){
int ptr=cur+num;
for(int i=cur;i<cur+num;++i){
a.pb(ptr++);
b.pb(ptr++);
}
cur=cur+num;
num*=2;
++know;
}
for(int i=cur;i<cur+num;++i){
a.pb(i),b.pb(i);
}
//pf("%d:\n",sz(a));
//for(int i:a)pf("%d ",i);pf("\n");
//for(int i:b)pf("%d ",i);pf("\n");
int res=Query(sz(a),a,b);
res-=cur;
vector<char> v;
while(num!=1){
v.pb((res&1)+'0');
res>>=1;
num>>=1;
}
while(!v.empty()){
ans.pb(v.back());
//pf("add %c\n",v.back());
v.pop_back();
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |