답안 #511462

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
511462 2022-01-15T22:12:14 Z Zhora_004 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
8 / 100
3000 ms 4340 KB
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#include <cstring>
#include <numeric>
#include <functional>
#include <chrono>
#include <cassert>
#include <bitset>
//#include <bit>
//#include <ranges>
//#include <numbers>
#define itn int
#define sacnf scanf
#define sz(a) ((int)((a).size()))
// printf("%.10f\n", ans);
using ll = long long;
using namespace std;
const ll mod = 1e9 + 7;
const int N = 1e6 + 5;



int main()
{
    /*ios_base::sync_with_stdio(false);
    cin.tie(NULL);*/
    int n, m;
    scanf("%d%d", &n, &m);
    vector<int> v(n);
    for (int i = 0; i < n; i++) scanf("%d", &v[i]);
    for (int i = 0; i < m; i++)
    {
        int l, r, k;
        scanf("%d%d%d", &l, &r, &k);
        l--, r--;
        int mx = 0;
        for (int j = l; j <= r; j++)
        {
            int mx_num = -1;
            for (int d = j + 1; d <= r; d++) if (v[d] < v[j]) mx_num = max(mx_num, v[d]);
            if (mx_num != -1) mx = max(mx, v[j] + mx_num);
        }
        if (mx <= k) printf("1\n");
        else printf("0\n");
    }

    return 0;
}


// https://codeforces.com/problemset/problem/1136/D?locale=ru

Compilation message

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:45:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
sortbooks.cpp:47:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |     for (int i = 0; i < n; i++) scanf("%d", &v[i]);
      |                                 ~~~~~^~~~~~~~~~~~~
sortbooks.cpp:51:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |         scanf("%d%d%d", &l, &r, &k);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 3 ms 296 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 284 KB Output is correct
6 Correct 25 ms 204 KB Output is correct
7 Correct 30 ms 204 KB Output is correct
8 Correct 33 ms 296 KB Output is correct
9 Correct 11 ms 304 KB Output is correct
10 Correct 27 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 3 ms 296 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 284 KB Output is correct
6 Correct 25 ms 204 KB Output is correct
7 Correct 30 ms 204 KB Output is correct
8 Correct 33 ms 296 KB Output is correct
9 Correct 11 ms 304 KB Output is correct
10 Correct 27 ms 204 KB Output is correct
11 Correct 1201 ms 348 KB Output is correct
12 Execution timed out 3045 ms 332 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3064 ms 4340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3072 ms 716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 3 ms 296 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 284 KB Output is correct
6 Correct 25 ms 204 KB Output is correct
7 Correct 30 ms 204 KB Output is correct
8 Correct 33 ms 296 KB Output is correct
9 Correct 11 ms 304 KB Output is correct
10 Correct 27 ms 204 KB Output is correct
11 Correct 1201 ms 348 KB Output is correct
12 Execution timed out 3045 ms 332 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 3 ms 296 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 284 KB Output is correct
6 Correct 25 ms 204 KB Output is correct
7 Correct 30 ms 204 KB Output is correct
8 Correct 33 ms 296 KB Output is correct
9 Correct 11 ms 304 KB Output is correct
10 Correct 27 ms 204 KB Output is correct
11 Correct 1201 ms 348 KB Output is correct
12 Execution timed out 3045 ms 332 KB Time limit exceeded
13 Halted 0 ms 0 KB -