結果

問題 No.1366 交換門松列・梅
ユーザー CyanmondCyanmond
提出日時 2021-01-29 21:53:16
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 5,247 bytes
コンパイル時間 4,029 ms
コンパイル使用メモリ 202,952 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 10:30:20
合計ジャッジ時間 4,575 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In member function 'std::pair<int, int> Long_Mantion::range_solve(int)':
main.cpp:103:5: warning: no return statement in function returning non-void [-Wreturn-type]
  103 |     }
      |     ^

ソースコード

diff #

//#pragma GCC target("avx")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#pragma region library
#include <boost/range/irange.hpp>
using boost::irange;
#pragma region Macros
#define EXPAND(x) x
#define _overload4(_1, _2, _3, _4, name, ...) name
#define rep1(i, n) for (decltype(n) i = 0; i < (n); ++i)
#define rep2(i, a, b) for (decltype(b) i = static_cast<decltype(b)>(a); i < (b); ++i)
#define rep3(i, a, b, c) for (decltype(b) i = static_cast<decltype(b)>(a); i < (b); i += static_cast<decltype(b)>(c))
#define rept(...) EXPAND(_overload4(__VA_ARGS__, rep3, rep2, rep1, )(__VA_ARGS__))
#define per1(i, n) for (decltype(n) i = (n); i >= 0; --i)
#define per2(i, a, b) for (decltype(a) i = (a); i >= static_cast<decltype(a)>(b); --i)
#define per3(i, a, b, c) for (decltype(a) i = (a); i >= static_cast<decltype(a)>(b); i -= static_cast<decltype(a)>(c))
#define pert(...) EXPAND(_overload4(__VA_ARGS__, per3, per2, per1, )(__VA_ARGS__))
#define itrall(x) std::begin(x), std::end(x)
using i16 = short;
using i32 = int;
using i64 = long long;
#pragma endregion
#ifndef CnM_library
#define debug(x)
constexpr int dx[] = { 1, 0, -1, 0 };
constexpr int dy[] = { 0, 1, 0, -1 };
template <class T> static constexpr T INF = std::numeric_limits<T>::max() / 2;
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
#define elif else if
#define len(T) (int)(T).size()
template <class T, class U> inline bool ckmax(T& A, const U& B) { return B > A ? A = B, true : false; }
template <class T, class U> inline bool ckmin(T& A, const U& B) { return B < A ? A = B, true : false; }
struct setup_fixed { setup_fixed() { std::cout << std::fixed << std::setprecision(15); } } setup_fixed_;
namespace lib {
    template <class T, class U> inline T Pow(T A, U B) { T res(1); while (B) { if (B & 1) res *= A; A *= A; B >>= 1; } return res; }
    inline long long gcd(long long A, long long B) { while (B) { const long long C = A; A = B; B = C % B; } return A; }
    inline long long lcm(const long long A, const long long B) { return A / gcd(A, B) * B; }
    inline long long extgcd(long long A, long long B, long long& X, long long& Y) {
        long long D = A; if (B != 0) { D = extgcd(B, A % B, Y, X); Y -= (A / B) * X; return D; }
        else { X = 1; Y = 0; return A; }
    }
    inline long long modpow(long long A, long long B, const long long MOD) {
        long long res(1); while (B) { if (B & 1) res *= A, res %= MOD; A *= A; A %= MOD; B >>= 1; } return res;
    }
    template <class T> inline T inverse(T A, const T M) {
        T B = M, U = 1, V = 0; while (B) { T t = A / B; A -= t * B; std::swap(A, B); U -= t * V; std::swap(U, V); }
        U %= M; return U < 0 ? U += M, U : U;
    }
}
template <class T> inline void read(T& Tar) { std::cin >> Tar; return; }
template <class T, class... Ts> inline void read(T& Tar, Ts&... ts) { std::cin >> Tar; read(ts...); return; }
template <class T> inline void print(T Tar) { std::cout << Tar; return; }
template <class T, class... Ts> inline void print(T Tar, Ts... ts) { std::cout << Tar; print(ts...); return; }
#endif
#pragma endregion

struct Long_Mantion {
    int N;
    std::vector<int> C;
    std::vector<std::vector<int>> keys;
    std::vector<int> Memo, o_1, o_2;
    std::vector<std::pair<int, int>> range_ans;

    Long_Mantion() {
        // input

        read(N);
        C.resize(N - 1);
        rept(i, N - 1) read(C[i]);
        keys.resize(N);
        rept(i, N) {
            int B; read(B);
            keys[i].resize(B);
            rept(j, B) {
                int X; read(X); X--;
                keys[i][j] = X;
            }
        }

        // 端を出す

        Memo.resize(N, -1);
        o_1.resize(N);
        o_2.resize(N);
        rept(i, N - 1) {
            for (auto& key : keys[i]) ckmax(Memo[key], i);
            o_1[i] = Memo[C[i]];
        }

        std::fill(itrall(Memo), N + 1);

        pert(i, N - 2, 0) {
            for (auto& key : keys[i + 1]) ckmin(Memo[key], i);
            o_2[i] = Memo[C[i]];
        }
    }

    std::pair<int, int> range_solve(int v) {
        // ここできない
    }

    void solve() {
        int Q; read(Q);
        range_ans.resize(N, std::make_pair(-1, -1));

        rept(i, N) range_solve(i);
        rept(i, Q) {
            int x, y; read(x, y); x--;
            auto check = [&](int x, int y)->bool {
                std::pair<int, int> C = range_ans[x];
                return (C.first <= y && C.second >= y);
            };
            print((check(x, y)) ? "Yes\n" : "No\n");
        }
    }
};

//ゆきこするぜ

struct TaskA {
    void solve() {
        int A[3], B[3];
        rept(i, 3) read(A[i]);
        rept(i, 3) read(B[i]);
        rept(i, 3) rept(j, 3) {
            std::swap(A[i], B[j]);
            if (A[0] != A[1] && A[1] != A[2] && A[0] != A[2] && B[0] != B[1] && B[1] != B[2] && B[0] != B[2] && ((A[1] > A[0] && A[1] > A[2]) || (A[1] < A[0] && A[1] < A[2])) && ((B[1] > B[0] && B[1] > B[2]) || (B[1] < B[0] && B[1] < B[2]))) { print("Yes\n"); return; }
            std::swap(A[i], B[j]);
        }
        print("No\n");
    }
};

int main(void) {
    TaskA solver;
    solver.solve();

    return 0;
}
0