結果

問題 No.624 Santa Claus and The Last Dungeon
ユーザー e869120e869120
提出日時 2017-12-23 19:49:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,068 bytes
コンパイル時間 885 ms
コンパイル使用メモリ 82,628 KB
実行使用メモリ 24,348 KB
平均クエリ数 503.31
最終ジャッジ日時 2023-09-23 15:19:17
合計ジャッジ時間 6,987 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
24,048 KB
testcase_01 AC 46 ms
23,448 KB
testcase_02 AC 47 ms
23,688 KB
testcase_03 AC 50 ms
24,012 KB
testcase_04 AC 50 ms
24,228 KB
testcase_05 AC 51 ms
23,616 KB
testcase_06 AC 47 ms
23,580 KB
testcase_07 AC 48 ms
24,348 KB
testcase_08 AC 50 ms
24,336 KB
testcase_09 AC 50 ms
23,688 KB
testcase_10 AC 47 ms
24,312 KB
testcase_11 AC 46 ms
24,216 KB
testcase_12 AC 47 ms
23,604 KB
testcase_13 AC 47 ms
23,700 KB
testcase_14 AC 48 ms
24,072 KB
testcase_15 AC 49 ms
24,012 KB
testcase_16 AC 48 ms
23,688 KB
testcase_17 AC 54 ms
24,348 KB
testcase_18 AC 47 ms
23,784 KB
testcase_19 AC 46 ms
23,616 KB
testcase_20 AC 46 ms
23,484 KB
testcase_21 AC 48 ms
24,000 KB
testcase_22 AC 46 ms
24,012 KB
testcase_23 AC 46 ms
23,340 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘std::tuple<int, int, int> Get(std::vector<std::__cxx11::basic_string<char> >)’ 内:
main.cpp:32:1: 警告: 制御が非 void 関数の終りに到達しました [-Wreturn-type]
   32 | }
      | ^

ソースコード

diff #

#include <iostream>
#include <tuple>
#include <vector>
#include <tuple>
#include <string>
#include <ctime>
using namespace std;

int Q, a[200], b[100]; bool used[100]; vector<int>B;
int Debug = 1;

tuple<int, int, int> Get(vector<string>V) {
	if (Debug == 0) {
		int c[3] = { 0,0,0 };
		for (int i = 0; i < 100; i++) {
			string U = to_string(b[i]); if (U.size() == 1)U = "0" + U;
			int cnt = 0;
			if (U[0] == V[i][0])cnt++;
			if (U[1] == V[i][1])cnt++;
			c[cnt]++;
		}
		return make_tuple(c[0], c[1], c[2]);
	}
	if (Debug == 1) {
		for (int i = 0; i < 100; i++) {
			if (i)cout << " "; cout << V[i];
		}
		cout << endl;
		int V1, V2, V3; cin >> V1 >> V2 >> V3;
		return make_tuple(V1, V2, V3);
	}
}
void query(int l, int r, int p, int x, int rec, vector<int>G) {
	if (l == r) {
		B.push_back(G[l]);
		return;
	}
	vector<string> R1, R2;
	for (int i = 0; i < 100; i++) {
		R1.push_back("??");
	}
	int m = (l + r) / 2;
	for (int i = G[l]; i <= G[m]; i++) {
		if (p == 0) R1[i][0] = (char)('0' + x);
		if (p == 1) R1[i][1] = (char)('0' + x);
	}
	tuple<int, int, int>A = Get(R1);
	int sums = get<1>(A) + get<2>(A) * 2;
	if (sums >= 1) query(l, m, p, x, sums, G);
	if (rec - sums >= 1)query(m + 1, r, p, x, rec - sums, G);
}
void makerand() {
	bool uu[100];
	for (int i = 0; i < 100; i++)uu[i] = false;
	for (int j = 0; j < 100; j++) {
		while (true) {
			int H = rand() % 100;
			if (uu[H] == false) { b[j] = H; uu[H] = true; break; }
		}
	}
}
int main() {
	srand((unsigned)time(NULL));
	cin >> Q; makerand();
	for (int i = 0; i < 200; i++)a[i] = 9;
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 100; j++)used[j] = false;
		for (int j = 0; j < 9; j++) {
			vector<int>J;
			for (int k = 0; k < 100; k++) {
				if (used[k] == false)J.push_back(k);
			}
			B.clear();
			query(0, J.size() - 1, i, j, 10, J);
			for (int k = 0; k < B.size(); k++) {
				used[B[k]] = true; a[B[k] * 2 + i] = j;
			}
		}
	}
	for (int i = 0; i < 200; i++) {
		if (i >= 2 && i % 2 == 0)cout << " ";
		cout << a[i];
	}
	cout << endl;
	int V1, V2, V3; cin >> V1 >> V2 >> V3;
	return 0;
}
0