| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1296909 | nguyhoangphu | Weighting stones (IZhO11_stones) | C++20 | 1 ms | 332 KiB |
#include<bits/stdc++.h>
using namespace std;
#define file "stone"
#define int long long
#define ll long long
#define pii pair<int, int>
#define pli pair<ll, int>
#define fi first
#define se second
#define sz(a) (int)a.size()
#define pb push_back
#define mask(i) (1 << i)
const int N = 1e5, inf = 1e9;
void MAX(int &a, int b) { a = max(a, b); }
void MIN(int &a, int b) { a = min(a, b); }
struct stt
{
int i, w, tp;
bool operator < (const stt &o) const
{
return i < o.i;
}
};
int n;
int W[3], cnt[3];
vector<stt> a;
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if (fopen(file".in", "r"))
{
freopen(file".in", "r", stdin);
freopen(file".out", "w", stdout);
}
cin >> n;
for (int i = 1; i <= n; i++)
{
int p, tp;
cin >> p >> tp;
a.pb({p, i, tp});
}
sort(a.begin(), a.end());
int val = 0, wmax = 0;
for (stt x : a)
{
if (x.w > val) val = x.w, wmax = x.tp;
W[x.tp] += x.w;
cnt[x.tp]++;
int kt = 0;
if (W[1] > W[2] && cnt[1] >= cnt[2]) kt = 1;
else if (W[2] > W[1] && cnt[2] >= cnt[1]) kt = 2;
if (kt == wmax)
{
if (kt == 1) cout << ">\n";
else cout << "<\n";
}
else cout << "?\n";
}
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
