Submission #649483

# Submission time Handle Problem Language Result Execution time Memory
649483 2022-10-10T09:41:20 Z murad_2005 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
8 / 100
3000 ms 22352 KB
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2")
#pragma GCC optimize("unroll-loops")
#define ll long long
#define ld long double
#define ull unsigned long long
#define ui unsigned int
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define pf push_front
#define pii pair<int, int>
#define pil pair<int, ll>
#define plli pair<long long, int>
#define pdi pair<double, int>
#define pldldi pair<ld, pair<ld, int>>
#define pdd pair<double, double>
#define pid pair<int, double>
#define piii pair<int, pair<int, int>>
#define pllll pair<long long, long long>
#define pllllll pair<ll, pllll>
#define INF 2e9 + 5
#define size(v) v.size()
#define f first
#define s second
#define Pi 3.14159265359

using namespace std;

void Subtask1and2(int n, int m, vector<int>&a){
    while(m--){
        int l, r, k, flag = 0;
        cin >> l >> r >> k;
        vector<int>v;
        v.clear();
        for(int i = l; i <= r; i++){
            v.pb(a[i]);
        }
        for(int i = 1; i < size(v); i++){
            int Max = -INF;
            for(int j = 0; j < i; j++){
                Max = max(Max, v[j]);
            }
            if(Max > v[i] && Max + v[i] > k){
                flag = 1;
                break;
            }
        }
        cout << (flag ^ 1) << "\n";
    }

}




void solve(){
    int n, m;
    cin >> n >> m;
    vector<int>a(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    Subtask1and2(n, m, a);

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Compilation message

sortbooks.cpp: In function 'void Subtask1and2(int, int, std::vector<int>&)':
sortbooks.cpp:41:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for(int i = 1; i < size(v); i++){
      |                          ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 94 ms 316 KB Output is correct
9 Correct 28 ms 212 KB Output is correct
10 Correct 44 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 94 ms 316 KB Output is correct
9 Correct 28 ms 212 KB Output is correct
10 Correct 44 ms 212 KB Output is correct
11 Correct 20 ms 420 KB Output is correct
12 Correct 92 ms 480 KB Output is correct
13 Correct 75 ms 468 KB Output is correct
14 Correct 206 ms 528 KB Output is correct
15 Correct 74 ms 524 KB Output is correct
16 Execution timed out 3044 ms 468 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3039 ms 22352 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3034 ms 1792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 94 ms 316 KB Output is correct
9 Correct 28 ms 212 KB Output is correct
10 Correct 44 ms 212 KB Output is correct
11 Correct 20 ms 420 KB Output is correct
12 Correct 92 ms 480 KB Output is correct
13 Correct 75 ms 468 KB Output is correct
14 Correct 206 ms 528 KB Output is correct
15 Correct 74 ms 524 KB Output is correct
16 Execution timed out 3044 ms 468 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 94 ms 316 KB Output is correct
9 Correct 28 ms 212 KB Output is correct
10 Correct 44 ms 212 KB Output is correct
11 Correct 20 ms 420 KB Output is correct
12 Correct 92 ms 480 KB Output is correct
13 Correct 75 ms 468 KB Output is correct
14 Correct 206 ms 528 KB Output is correct
15 Correct 74 ms 524 KB Output is correct
16 Execution timed out 3044 ms 468 KB Time limit exceeded
17 Halted 0 ms 0 KB -