Submission #234396

#TimeUsernameProblemLanguageResultExecution timeMemory
234396VEGAnnDeda (COCI17_deda)C++14
120 / 140
1075 ms5600 KiB
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
using namespace std;
typedef long long ll;
const int N = 200100;
const int oo = 2e9;
int n, q, tim[N];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL

    cin >> n >> q;

    for (int i = 0; i < n; i++)
        tim[i] = oo;

    for (; q; q--){
        char tp; int a, b; cin >> tp >> a >> b;

        b--;

        if (tp == 'M')
            tim[b] = a;
        else {
            int ans = -1;
            for (int i = b; i < n; i++)
                if (tim[i] <= a){
                    ans = i + 1;
                    break;
                }

            cout << ans << '\n';
        }
    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...