Submission #88607

#TimeUsernameProblemLanguageResultExecution timeMemory
88607BadralWeighting stones (IZhO11_stones)C++17
0 / 100
1065 ms632 KiB
#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 timeMemoryGrader output
Fetching results...