이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho
#include "doll.h"
using ll=int;
using ld=long double;
int const INF=1000000005;
//ll const LINF=1000000000000000005;
ll const mod=1000000007;
ld const PI=3.14159265359;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll lt[300005],rt[300005],cnt=0,switches=0,val=0,nr=0,ans[300005],b[300005];
ll build(ll node,ll realnodes){
if(realnodes==0){
return -1;
}
if(node==1){
return (nr++);
}
ll centr=-(++switches);
lt[-centr]=build(node/2,realnodes-min(node/2,realnodes));
rt[-centr]=build(node/2,min(node/2,realnodes));
return centr;
}
ll dfs(ll node){
if(node>=0){
return node;
}
b[-node]=!b[-node];
if(b[-node]==1){
dfs(lt[-node]);
}else dfs(rt[-node]);
}
void create_circuit(int m,vector<int>a){
map<ll,ll>viz;
vector<ll>C;
for(int i=0;i<=m;i++)
{
C.pb(-1);
}
ll x=a.size();
nr=0;
x++;
ll nodes=1;
while(nodes<x){
nodes*=2;
}
build(nodes,x);
a.pb(0);
for(ll i=0;i<a.size();i++)
{
ans[dfs(-1)]=a[i];
}
vector<int>X,Y;
for(ll i=1;i<=switches;i++)
{
ll x,y;
x=lt[i];
y=rt[i];
if(x>=0){
X.pb(ans[x]);
}else {
X.pb(x);
}
if(y>=0){
Y.pb(ans[y]);
}else Y.pb(y);
}
return answer(C,X,Y);
}
컴파일 시 표준 에러 (stderr) 메시지
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:56:13: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
56 | for(ll i=0;i<a.size();i++)
| ~^~~~~~~~~
doll.cpp: In function 'll dfs(ll)':
doll.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
39 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |