Submission #234396

# Submission time Handle Problem Language Result Execution time Memory
234396 2020-05-24T06:57:18 Z VEGAnn Deda (COCI17_deda) C++14
120 / 140
1000 ms 5600 KB
#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 time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Execution timed out 1075 ms 2696 KB Time limit exceeded
5 Correct 244 ms 4856 KB Output is correct
6 Correct 381 ms 5240 KB Output is correct
7 Correct 615 ms 5600 KB Output is correct