# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
88607 | Badral | 돌 무게 재기 (IZhO11_stones) | C++17 | 1065 ms | 632 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |