結果

問題 No.3705 ビバ子とマカロン (Bibako and Macaron)
コンテスト
ユーザー rexip
提出日時 2026-09-12 09:40:37
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
RE  
実行時間 -
コード長 1,497 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,907 ms
コンパイル使用メモリ 354,332 KB
実行使用メモリ 6,840 KB
最終ジャッジ日時 2026-09-12 09:41:02
合計ジャッジ時間 12,045 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
サブタスク 配点 結果
小課題1 10 % AC * 1 RE * 4
小課題2 30 % AC * 4 RE * 4
小課題3 60 % -- * 15
合計 0 点
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
   int n; cin >> n;
   vector<int>mac(n);
   vector<int>info(n);
   for(int i=0; i < n;i++){
    int k; cin >> k;
    mac[i]=k;
    info[k-1]++;
   }
   vector<int>zero;
   vector<int>one;
   for(int i=0; i < n;i++){
    if(info[i]==0) zero.push_back(i+1);
    if(info[i] < 2) one.push_back(i+1);
   }
   //どうやら1~nの順列ではない?
   int q; cin >> q;
   for(int i=0; i < q;i++){
    //1個または2個があるか…みたいな
    //失敗する場合は、”そもそも存在しない”
    //または"かぶって2個ない"に分かれる
    //まず0があるかlowerboundでやる?
    //LについてlowerboundしてitrがRより右でYes
    //つぎに、1以下のマカロンの配列を作り、
    //min(R,R\)<max(l,l\)のときlowerboundでよさそう
    int p,q,r,s; cin >> p >> q >> r >> s;
    //p,r,q,sの順の時がおかしくなる
    auto x=lower_bound(zero.begin(),zero.end(),p);
    auto y=lower_bound(zero.begin(),zero.end(),r);
    if(min(q,s) >= max(p,r)){
        int a=max(p,r);
        int b=min(q,s);
        auto z=lower_bound(one.begin(),one.end(),a);
        if(z != one.end() and *z <= b) {
            cout << "No" << endl;
            continue;
        }
    }
    if((*x <= q and x != zero.end()) or (*y <= s and y != zero.end())) cout << "No" << endl;
    else cout << "Yes" << endl;

   }
}

0