답안 #716912

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
716912 2023-03-31T11:41:57 Z myrcella 자동 인형 (IOI18_doll) C++17
12 / 100
82 ms 11436 KB
//by szh
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}
#include "doll.h"

const int maxn = 2e5+10;

vector <int> X,Y;
int tot;
int cur = 1;
int cnt = 0;

void dfs(int suf,int lg) {
	int id = cur++;
	X.pb(-maxn),Y.pb(-maxn);
	lg--;
	if (lg==0) {
		if (suf+1==tot) X[id-1] = -1;
		return;
	}
	Y[id-1] = -cur;
	dfs(suf,lg);
	if (suf + (1<<lg) < tot) {
		X[id-1] = -cur;
		dfs(suf + (1<<lg), lg);
	}
	else X[id-1] = -1;
}

bool vis[maxn];

int nxt(int x) {
	int ret;
	if (vis[x]==false) ret = X[x-1];
	else ret = Y[x-1];
	vis[x]^=1;
	if (vis[x]) cnt++;
	else cnt--;
	return -ret;
}

void create_circuit(int M, std::vector<int> A) {
	tot=SZ(A)+1;
  A.pb(0);
  int lg = 0;
  while ((1<<lg)<tot) lg++;
  dfs(0,lg);
  memset(vis,0,sizeof(vis));
  rep(i,0,tot) {
	  int cur=1,tmp;
	  while ((tmp=nxt(cur))!=maxn) cur = tmp;
		if (vis[cur]==false) Y[cur-1] = A[i];
		else X[cur-1] = A[i];
  }
  vector <int> C;
  rep(i,0,M+1) C.pb(-1);
  answer(C, X, Y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 44 ms 4204 KB Output is correct
3 Correct 40 ms 4492 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 11 ms 1740 KB Output is correct
6 Correct 70 ms 6484 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 44 ms 4204 KB Output is correct
3 Correct 40 ms 4492 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 11 ms 1740 KB Output is correct
6 Correct 70 ms 6484 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 80 ms 7920 KB Output is correct
9 Correct 82 ms 8224 KB Output is correct
10 Runtime error 38 ms 11436 KB Execution killed with signal 11
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 44 ms 4204 KB Output is correct
3 Correct 40 ms 4492 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 11 ms 1740 KB Output is correct
6 Correct 70 ms 6484 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 80 ms 7920 KB Output is correct
9 Correct 82 ms 8224 KB Output is correct
10 Runtime error 38 ms 11436 KB Execution killed with signal 11
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 436 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 63 ms 6184 KB Output is correct
3 Correct 69 ms 6132 KB Output is correct
4 Runtime error 36 ms 11388 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 63 ms 6184 KB Output is correct
3 Correct 69 ms 6132 KB Output is correct
4 Runtime error 36 ms 11388 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -