結果

問題 No.934 Explosive energy drink
ユーザー 👑 nullnull
提出日時 2019-12-17 23:15:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
QLE  
(最初)
実行時間 -
コード長 3,576 bytes
コンパイル時間 1,734 ms
コンパイル使用メモリ 139,792 KB
実行使用メモリ 36,156 KB
平均クエリ数 1.08
最終ジャッジ日時 2023-09-23 19:18:03
合計ジャッジ時間 6,042 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
23,472 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
このコード、と~おれ!
Be accepted!
∧_∧ 
(。・ω・。)つ━☆・*。
⊂   ノ    ・゜+.
 しーJ   °。+ *´¨)
          .· ´¸.·*´¨) ¸.·*¨)
		            (¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

ll nearPow2(ll n)//x以上の2のべき乗を返す
{
	// nが0以下の時は0とする。
	if (n <= 0) return 0;

	// (n & (n - 1)) == 0 の時は、nが2の冪乗であるため、そのままnを返す。
	if ((n & (n - 1)) == 0) return ll(n);

	// bitシフトを用いて、2の冪乗を求める。
	ll ret = 1;
	while (n > 0) { ret <<= 1; n >>= 1; }
	return ret;
}

int main() {

	int n;
	scanf("%d", &n);
	random_device rnd;
	mt19937 mt(rnd());
	uniform_int_distribution<> rand(1, n);
	vector<bool> a(n), isdangerous(n);
	int ans = 0;
	int first = 1, second = 2;
	while (!ans) {
		first = rand(mt);
		//while (a[first - 1])first = rand(mt);
		a[first - 1] = true;
		second = rand(mt);
		//while (a[second - 1])second = rand(mt);
		a[second - 1] = true;
		if (first > second)swap(first, second);
		printf("? 2\n%d %d\n", first, second);
		fflush(stdout);
		scanf("%d", &ans);
	}
	isdangerous[first - 1] = isdangerous[second - 1] = true;
	rep(i, n) {
		if (i + 1 == first || i + 1 == second)continue;
		printf("? 2\n%d %d\n", first, i + 1);
		fflush(stdout);
		scanf("%d", &ans);
		if (ans)isdangerous[i] = true;
	}
	vector<int> anss;
	rep(i, n) {
		if (isdangerous[i])anss.pb(i + 1);
	}

	int size = anss.size();
	printf("! %d\n", size);
	for (auto aa : anss) {
		printf("%d ", aa);
	}
	fflush(stdout);
	printf("\n");

	Please AC;
}
0