QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#448289#4912. WereYouLastasupersalmon0 1ms4968kbC++141.0kb2024-06-19 15:14:562024-06-19 15:14:56

Judging History

你现在查看的是最新测评结果

  • [2024-06-19 15:14:56]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:4968kb
  • [2024-06-19 15:14:56]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

bool query(int);
void modify(int,bool);

bool WereYouLast(int N, int m){
	if(N == (1<<10)){
		int num = 0;
		
		for(int i = 0; i < 10; i++){
			num += ((int)query(i)<<i);
		}		
		if(num == (1<<10)-1) return 1;
		
		num++;
		
		for(int i = 0; i < 10; i++){
			modify(i,(num&(1<<i))>0);
		}

		
		return 0;
	}
	else if(true){
		bitset<65> arr("00000000000000000001101001100101000000000100001111000010000000000");
		
		int num = 1;
		bool die = true;
		int l[6];
		int s = 6;
		for(int i = 0; i < 6; i++){
			die &= (query(num)^arr[num]);
			l[i]=num;
			num = num * 2;
			if(query(num/2)^arr[num/2]) num++; 
			if( arr[1]^query(1) && i == 3){
				s = 4;
				break;
			}
		}
		if(die) return 1;
		
		for(int i = s - 1; i >= 0; i--){
			if(!(query(l[i])^arr[l[i]]) ){
				modify(l[i],!arr[l[i]]);
				s = i - 1;
				break;
			}
			modify(l[i],arr[l[i]]);
		}

		for(int i = s; i >= 0; i--){
			modify(l[i],arr[l[i]]);
		}
		return 0;
	}
	return 1;

}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3804kb

input:

1024 10

output:

12345876 -2 0

result:

wrong answer Invalid Operation At Position 0.

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 4948kb

input:

65536 100000

output:

12345876 -2 1

result:

wrong answer Invalid Operation At Position 1.

Subtask #3:

score: 0
Wrong Answer

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 4964kb

input:

1048576 100000

output:

12345876 -2 1

result:

wrong answer Invalid Operation At Position 1.

Subtask #4:

score: 0
Wrong Answer

Test #4:

score: 0
Wrong Answer
time: 1ms
memory: 4968kb

input:

67108864 100000

output:

12345876 -2 1

result:

wrong answer Invalid Operation At Position 1.