Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
504 B
4
Indexable
Never
#include<iostream>
#include<vector>

using namespace std;

extern bool checkCards(int mIndexA, int mIndexB, int mDiff);


vector<int> mang[50005];

int differ(int index1, int index2){
	int l=0; int r=50000;
	while(l<r){
		int mid = (l+r)/2;
		if(checkCards(index1, index2, mid)) r = mid;
		else l = mid+1;
	}
	return l;
}

void playGame(int N){
	for(int i=0;i<2*N;i++){
		mang[differ(i, 0)].push_back(i);
	}
	for(int i=1;i<=N;i++){
		checkCards(mang[i][0], mang[i][1], 0);
	}
}
Leave a Comment