# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
860182 | aykhn | 돌 무게 재기 (IZhO11_stones) | C++14 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
// author : aykhn
using namespace std;
typedef long long ll;
#define pb push_back
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcount
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define int ll
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
int n;
cin >> n;
set<int> v[2];
for (int i = 1; i <= n; i++)
{
int x, y;
cin >> x >> y;
v[y - 1].ins(x);
auto it0 = v[0].rbegin();
auto it1 = v[1].rbegin();
int c0, c1;
c0 = c1 = 0;
int cnt = 0;
if (i == 1)
{
cout << (v[0].size() ? '>' : '<') << '\n';
continue;
}
while (it0 != v[0].rend() && it1 != v[1].rend())
{
if (*it0 > *it1) c0++;
else c1++;
it0++;
it1++;
cnt++;
}
if (cnt == c0)
{
if (v[0].size() >= v[1].size())
{
cout << ">\n";
}
else
{
cout << "?\n";
}
}
else if (cnt == c1)
{
if (v[1].size() >= v[0].size())
{
cout << "<\n";
}
else
{
cout << "?\n";
}
}
else cout << "?\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |