# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
925324 | Karoot | Collider (IZhO11_collider) | C++17 | 0 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/extc++.h>
#include <iostream>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <iomanip>
#include <algorithm>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
typedef long long ll;
ll linf = 1e15+1;
inline void scoobydoobydoo(){
ios::sync_with_stdio(false);
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
using namespace __gnu_pbds;
template<class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag,
tree_order_statistics_node_update>;
int main(){
scoobydoobydoo();
int n, m; cin >> n >> m;
Tree<pair<int, int> > s; // %3 0 -> x, 1 -> y, 2 -> z
for (int i = 0; i < n; i++){
char c; cin >> c;
if (c == 'x')s.insert({i, 0});
else if (c == 'y')s.insert({i, 1});
else s.insert({i, 2});
}
for (int i = 0; i < m; i++){
char c; cin >> c;
if (c == 'a'){
int x, y; cin >> x >> y;
x--; y--;
auto it = s.find_by_order(x);
int sec = (*it).second;
s.erase(it);
s.insert({y, sec+3});
} else {
int x; cin >> x;
x--;
auto it = s.find_by_order(x);
int sec = (*it).second%3;
if (sec == 0){
cout << 'x' << endl;
} else if (sec == 1){
cout << 'y' << endl;
} else {
cout << 'z' << endl;
}
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |