Submission #340206

# Submission time Handle Problem Language Result Execution time Memory
340206 2020-12-27T09:28:23 Z Sprdalo Simple game (IZhO17_game) C++17
22 / 100
1000 ms 1672 KB
#include <bits/stdc++.h>

using namespace std;

#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    

    int n, m;
    cin >> n >> m;

    vi a(n);
    for (auto& i : a)
        cin >> i;

    for (int e = 0; e < m; ++e){
        int z;
        cin >> z;

        if (z == 1){
            int pos, val;
            cin >> pos >> val;
            a[pos-1]=val;
        } else {
            int h, sol = 0;
            cin >> h;

            for (int i = 1; i < n; ++i){
                if (h >= min(a[i], a[i-1]) && h <= max(a[i], a[i-1]))
                    ++sol;
            }

            cout << sol << '\n';
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 3 ms 404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 3 ms 404 KB Output is correct
8 Execution timed out 1091 ms 1672 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 3 ms 404 KB Output is correct
8 Execution timed out 1091 ms 1672 KB Time limit exceeded
9 Halted 0 ms 0 KB -