# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
978106 |
2024-05-08T19:42:22 Z |
vjudge1 |
Deda (COCI17_deda) |
C++17 |
|
51 ms |
10588 KB |
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including
// tree_order_statistics_node_update #include
//<ext/pb_ds/detail/standard_policies.hpp>
#define S second
#define F first
#define vll vector<ll>
#define pll pair<ll, ll>
#define mll vector<vll>
#define sll set<ll>
#define vstring vector<string>
#define rep(x, g, y) for (ll x = g; x < y; x++)
#define rrep(x, g, y) for (ll x = g; x >= y; x--)
#define all(a) (a).begin(), (a).end()
using namespace std;
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
// CRAM DEJA DE VER MIS ENVIOS MALDITO
// SUPER SET
// typedef tree<int, null_type, less<int>, rb_tree_tag,
// tree_order_statistics_node_update> ordered_set;
// SUPER MULTISET
// typedef tree<long long, null_type, less_equal<>, rb_tree_tag,
// tree_order_statistics_node_update> indexed_multiset;
// USOS
// imprimer la cantidad de elementos escritamente menor a X
// cout << aux.order_of_key(x)<<"\n";
// imprime el elemento k-esimo mas grande(comenzando desde 0)
// cout<<*X.find_by_order(K)<<endl;
// TIP: lower y upper invertidos en multiset.
// ll mod=1e9+7;
// ll expo(ll a, ll b)
// {
// if(a==0) return b==0;
// ll ans=1;
// while (b)
// {
// if(b&1) ans=(ans*a)%mod;
// b>>=1LL;
// a=(a*a)%mod;
// }
// return ans;
// }
ll lcm(ll a, ll b) { return (a * b) / __gcd(a, b); }
void yes() { cout << "YES\n"; }
void no() { cout << "NO\n"; }
template <class T> void print_v(vector<T> &v) {
cout << "{";
for (auto x : v)
cout << x << ",";
cout << "\b}\n";
}
void update(vll &st, ll l, ll r, ll nd, ll pos, ll valor) {
ll mid = (l + r) / 2;
if (l == r) {
st[nd] = valor;
return;
}
if (pos <= mid)
update(st, l, mid, nd * 2, pos, valor);
else
update(st, mid + 1, r, nd * 2 + 1, pos, valor);
st[nd] = min(st[nd * 2], st[nd * 2 + 1]);
}
ll query(vll &st, ll l, ll r, ll nd, ll lq, ll rq, ll valor) {
if (valor < st[nd])
return -1;
ll mid = (l + r) / 2;
if (l == r)
return l + 1;
if (st[nd * 2] >= valor && mid >= lq)
return query(st, l, mid, nd * 2, lq, rq, valor);
else
return query(st, mid + 1, r, nd * 2+1, lq, rq, valor);
}
void solve() {
ll n, q;
cin >> n >> q;
vll st(4*n,1e12);
while (q--) {
char x;
cin >> x;
ll a, b;
cin >> a >> b;
if (x == 'M')
{
//cout << a<<"\n";
update(st, 0, n - 1, 1, --b, a);
}
else
cout << query(st, 0, n - 1, 1, --b, n-1, a) << "\n";
//print_v(st);
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// ll t; cin >> t;
// while(t--)
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
47 ms |
10588 KB |
Output isn't correct |
5 |
Incorrect |
51 ms |
7252 KB |
Output isn't correct |
6 |
Incorrect |
51 ms |
8768 KB |
Output isn't correct |
7 |
Incorrect |
51 ms |
10580 KB |
Output isn't correct |