답안 #263286

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
263286 2020-08-13T15:04:52 Z dorijanlendvaj Minerals (JOI19_minerals) C++14
0 / 100
5 ms 512 KB
#include "minerals.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("unroll-loops")
#define shandom_ruffle(a, b) shuffle(a, b, rng)
#define vi vector<int>
#define vl vector<ll>
#define popcnt __builtin_popcount
#define popcntll __builtin_popcountll
#define all(a) begin(a),end(a)

using namespace std;
using namespace __gnu_pbds;

using ll=long long;
using ull=unsigned long long;
using ld=long double;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

int laa=0;
map<int,int> im;

int query(int a)
{
	int z=Query(a);
	if (z==laa) return 1;
	else
	{
		if (!im[a]) ++laa,im[a]=1;
		else --laa,im[a]=0;
		return 0;
	}
}

void Solve(int N) {
	vi v1,v2;
	for (int i=1;i<=2*N;++i)
	{
		int u=query(i);
		if (u==1) v2.pb(i),Query(i);
		else v1.pb(i);
		cout<<i<<' '<<u<<endl;
	}
	/*for (auto a: v1) cout<<a<<' ';
	cout<<endl;
	for (auto a: v2) cout<<a<<' ';
	cout<<endl;*/
	for (auto a: v1) query(a);
	vi ind(N);
	for (int b=14;b>=0;--b)
	{
		for (int i=0;i<N;++i) if (i&(1<<b)) query(v2[i]);
		for (int i=0;i<N;++i)
		{
			if (query(v1[i])) ind[i]+=1<<b;
			query(v1[i]);
		}
		for (int i=0;i<N;++i) if (i&(1<<b)) query(v2[i]);
	}
	/*for (auto a: ind) cout<<a<<' ';
	cout<<endl;*/
	for (int i=0;i<N;++i) Answer(v1[i],v2[ind[i]]);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 512 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 384 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -