Submission #925327

# Submission time Handle Problem Language Result Execution time Memory
925327 2024-02-11T12:34:28 Z Karoot Collider (IZhO11_collider) C++17
0 / 100
0 ms 344 KB
#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
    int counter = 1;
    
    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});
    }

    vector<char> ans;
    
    
    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*(counter++)});
        } else {
            int x; cin >> x;
            x--;
            auto it = s.find_by_order(x);
            int sec = (*it).second%3;
            if (sec == 0)ans.push_back('x');
            else if (sec == 1)ans.push_back('y');
            else ans.push_back('z');
            
        }
        //for (auto& e : s)cout << "(" << e.first << "," << e.second << "),  ";
        //cout << endl;
    }

    for (char c : ans)cout << c << endl;
    
    
    
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -