# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88607 | Badral | Weighting stones (IZhO11_stones) | C++17 | 1065 ms | 632 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |