Submission #376744

# Submission time Handle Problem Language Result Execution time Memory
376744 2021-03-12T03:03:07 Z Kevin_Zhang_TW Minerals (JOI19_minerals) C++17
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
#define pb emplace_back
#define AI(i) begin(i), end(i)
template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] = ", args)
void kout() { cerr << endl; }
template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l) == r], ++l; }
#else
#define DE(...) 0
#define debug(...) 0
#endif
#include "minerals.h"

int qry(int ind) { return Query(ind+1); }
void ans(int a, int b) { Answer(a+1, b+1); }

void Solve(int N) {
	vector<int> res(N + N);

	int M = N + N;

	auto isin = [&](int id) {
		static int lst = 0;
		int now = qry(id);
		return exchange(lst, now) == now;
	};

	for (int d = 0;1<<d < M;++d) {
		for (int i = 0;i < M;++i) if (i>>d&1) 
			if (isin(i)) res[i] |= 1<<d;
			
		for (int i = 0;i < M;++i) if (i>>d&1)
			if (isin(i)) res[i] |= 1<<d;
	}

	for (int i = 0;i < M;++i)
		if (res[i] < i)
			ans(i, res[i]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -