Submission #88607

# Submission time Handle Problem Language Result Execution time Memory
88607 2018-12-07T03:58:52 Z Badral Weighting stones (IZhO11_stones) C++17
0 / 100
1000 ms 632 KB
#include<bits/stdc++.h>

#define maxn 300000
#define ll long long
using namespace std;
ll a[maxn+5];
ll b[maxn+5];
map<string, bool> u;
map<ll, ll> o;

void maan() {
	int x, y;
ll s = 0;
ll ans = 0;
	cin >>x >>y;
	int n = x+y;
	for(int i = 1; i <= n; i++) {a[i] = i; }
	do{
		int s1 = 0;
		int s2 = 0;
		for(int i = 1; i <= n; i++) {
			b[i] = a[i];
		}
		sort(b+1, b+1+x);
		sort(b+2+x, b+1+n);
		string str;
		for(int i = 1; i <= n; i++) str += to_string(b[i]);
		if(u[str] == 1) continue;
		u[str] = 1;
		for(int i = 1; i <= x; i++) s1 += b[i];
		for(int i = x+1; i <= n; i++) s2 += b[i];
		if( s1 > s2) {
			s++;
		}
		if(s2 > s1) {
			ans++;
		}
	}while(next_permutation(a+1, a+1+n));
	if(!ans) {
		cout<<">\n";
	}
	else if(!s)cout<<"<\n";
	else cout<<"?\n";
}
int main() {
	int n;
	cin >>n;
	while(n--) {
		maan();
	}
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 632 KB Time limit exceeded
2 Halted 0 ms 0 KB -