結果

問題 No.2421 entersys?
ユーザー pleiades_223pleiades_223
提出日時 2023-08-12 15:14:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 8,199 bytes
コンパイル時間 7,295 ms
コンパイル使用メモリ 327,420 KB
実行使用メモリ 64,052 KB
最終ジャッジ日時 2024-11-20 00:35:02
合計ジャッジ時間 29,542 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 WA -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from main.cpp:2:
main.cpp:173:17: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
  173 | void output_tmp(auto &x);
      |                 ^~~~
main.cpp:178:17: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
  178 | void output_tmp(auto &x){output(x);}
      |                 ^~~~

ソースコード

diff #

#if !__INCLUDE_LEVEL__
#include __FILE__

using mint = modint1000000007;
//using mint = modint998244353;

struct query{
    ll a,t,l,r;
    string x;
};

int main(){
    LL(n);
    map<ll,ll>p,plus,minus;
    vll vec;
    map<string,vc<pll>>ma;
    rep(i,n){
        STR(str);
        LL(l,r);
        ma[str].pb(l,1);
        ma[str].pb(r+1,0);
        p[l];
        p[r+1];
        plus[l]++;
        minus[r+1]--;
    }
    LL(m);
    vc<query>q(m);
    rep(i,m){
        LL(a);
        if(a==1){
            STR(x);
            LL(t);
            q[i].x=x;
            q[i].t=t;
        }else if(a==2){
            LL(t);
            q[i].t=t;
        }else{
            STR(x);
            LL(l,r);
            q[i].x=x;
            q[i].l=l;
            q[i].r=r;
            p[l];
            p[r+1];
        }
        q[i].a=a;
    }
    ll cnt=0;
    vsrep(i,p){
        i.S=cnt;
        cnt++;
        vec.pb(i.F);
    }
    fenwick_tree<ll>tree(cnt+1);
    vrep(e,plus){
        tree.add(p[e.F],e.S);
    }
    vrep(e,minus){
        tree.add(p[e.F],e.S);
    }
    rep(i,m){
        if(q[i].a==1){
            pll y=mp(q[i].t,0);
            auto itr=lower_bound(all(ma[q[i].x]),y);
            if(q[i].t<(*itr).F||itr==ma[q[i].x].end())yesno(0);
            else yesno((*itr).S==1);
        }else if(q[i].a==2){
            ll k=lower_bound(all(vec),q[i].t)-vec.begin();
            print(tree.sum(0,k+1));
        }else{
            ll l=lower_bound(all(vec),q[i].l)-vec.begin();
            ll r=lower_bound(all(vec),q[i].r+1)-vec.begin();
            tree.add(l,1);
            tree.add(r,-1);
            ma[q[i].x].pb(q[i].l,1);
            ma[q[i].x].pb(q[i].r+1,0);
        }
    }
}

#else

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
void output(modint1000000007 x){cout << x.val();}
void output(modint998244353 x){cout << x.val();}
void debug_out(modint1000000007 x){cerr << x.val();}
void debug_out(modint998244353 x){cerr << x.val();}
#endif

#ifdef LOCAL
#define debug(...) {cerr << "\033[33mline:" << __LINE__ << endl; debug_func(0, #__VA_ARGS__, __VA_ARGS__);}
template<typename T>void debug_out(T &x){cerr << x;}
void debug_tmp(auto &x);
template<typename T,typename Y>void debug_out(pair<T,Y>&x){cerr<<"< ";debug_tmp(x.first);cerr << " , ";debug_tmp(x.second);cerr << " >";}
template<typename T>void debug_out(vector<T>&x){long long cnt=0;for(auto &i:x){cnt++;debug_out(i);if(cnt!=(long long)x.size())cerr << ' ';}}
template<typename T>void debug_out(vector<vector<T>>&x){cerr << endl;long long cnt=0;for(auto &i:x){cnt++;debug_out(i);if(cnt!=(long long)x.size())cerr << endl;}}
void debug_tmp(auto &x){debug_out(x);}
void debug_map(auto &x){
    cerr << endl;long long cnt=0;for(auto &t:x){cnt++;cerr << "Key:";debug_out(t.first);cerr << " Val:";debug_out(t.second);if(cnt!=(long long)x.size())cerr << endl;}
}
void debug_set(auto &x){
    long long cnt=0;for(auto &t:x){cnt++;debug_out(t);if(cnt!=(long long)x.size())cerr << " ";}
}
template<typename T>void debug_out(queue<T>x){while(!x.empty()){auto t=x.front();x.pop();debug_out(t);if(!x.empty())cerr << " ";}}
template<typename T>void debug_out(priority_queue<T>x){while(!x.empty()){auto t=x.top();x.pop();debug_out(t);if(!x.empty())cerr << " ";}}
template<typename T>void debug_out(priority_queue<T,vector<T>,greater<T>>x){while(!x.empty()){auto t=x.top();x.pop();debug_out(t);if(!x.empty())cerr << " ";}}
template<typename T,typename Y>void debug_out(map<T,Y>&x){debug_map(x);}
template<typename T,typename Y>void debug_out(unordered_map<T,Y>&x){debug_map(x);}
template<typename T>void debug_out(set<T>&x){debug_set(x);}
template<typename T>void debug_out(unordered_set<T>&x){debug_set(x);}
template<typename T>void debug_out(multiset<T>&x){debug_set(x);}
template<typename T> void debug_func(int _,T name){cerr << "\033[m";(void)_;(void)name;}
template<typename T,typename Y,typename ...Z> void debug_func(int _,T &name,Y &a,Z &...b){
    for(;name[_]!=','&&name[_]!='\0';_++)cerr << name[_];
    cerr << " : ";debug_out(a);cerr << endl;debug_func(_+1,name,b...);
}
#else
#define debug(...) ;
#endif

struct cin_init{cin_init(){ios::sync_with_stdio(false);std::cin.tie(nullptr);cout << fixed << setprecision(16);}}_cin_init;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vcc = vector<char>;
using vvcc = vector<vcc>;
using mii = map<int,int>;
using mll = map<ll,ll>;
template<typename T> using vc = vector<T>;
template<typename T> using vvc = vector<vector<T>>;
template<typename T,typename Y> using uomap = unordered_map<T,Y>;
template<typename T> using uoset = unordered_set<T>;
template<typename T> using revpriority_queue = priority_queue<T,vector<T>,greater<T>>;

int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
int ddx[8] = { -1,0,1,1,1,0,-1,-1 };
int ddy[8] = { 1,1,1,0,-1,-1,-1,0 };
constexpr long double lpi = 3.141592653589793238;
constexpr double pi = 3.141592653589793;
ll mod = 1000000007;
constexpr int inf = 1073741824;//2^30
constexpr ll llinf = 1152921504606846976;//2^60
void set_mod(){mod = 998244353;}

#define F first
#define S second
#define pb emplace_back
#define mp make_pair
template<typename T,typename Y>void input(pair<T,Y>&x){cin >> x.F >> x.S;}
template<typename T>void input(T &x){cin >> x;}
template<typename T>void input(vector<T>&x){for(auto &i:x)input(i);}
template<typename T>void input(vector<vector<T>>&x){for(auto &i:x)input(i);}
template<typename T,typename ...Y>void input(T& x,Y&...k){input(x);input(k...);}
void output_tmp(auto &x);
template<typename T>void output(T &x){cout << x;}
template<typename T,typename Y>void output(pair<T,Y>&x){output_tmp(x.first);cout << ' ' ;output_tmp(x.second);}
template<typename T>void output(vector<T>&x){ll cnt=0;for(auto &i:x){cnt++;output(i);if(cnt!=(long long)x.size())cout << ' ';}}
template<typename T>void output(vector<vector<T>>&x){ll cnt=0;for(auto &i:x){cnt++;output(i);if(cnt!=(long long)x.size())cout << endl;}}
void output_tmp(auto &x){output(x);}
template<typename T>void print(T x){output(x);cout << endl;}
template<typename T>void print_buffer(T &x){output(x);cout << endl;}
template<typename T,typename ...Y>void print_buffer(T& x,Y&...k){output(x);cout << endl;print_buffer(k...);}
template<typename T,typename ...Y>void print(T x,Y...k){output(x);cout << endl;print_buffer(k...);}
template<typename T> auto min(const T& x){ return *min_element(x.begin(),x.end()); }
template<typename T> auto max(const T& x){ return *max_element(x.begin(),x.end()); }
template<typename T> inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> void yesno(T x){if(x)cout << "Yes" << endl;else cout << "No" << endl;}
#define overload4(a,b,c,d,e,...)e
#define overload8(a,b,c,d,e,f,g,h,i,...)i
#define rep1(end) for(ll i=0;i<(ll)end;i++)
#define rep2(i,end) for(ll i=0;i<(ll)end;i++)
#define rep3(i,start,end) for(ll i=start;i<(ll)end;i++)
#define rep4(i,start,end,plus) for(ll i=start;i<(ll)end;i+=plus)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__; input(__VA_ARGS__);
#define STR(...) string __VA_ARGS__; input(__VA_ARGS__);
#define INT(...) int __VA_ARGS__; input(__VA_ARGS__);
#define VLL0(...) ;
#define VLL1(a,x,...) vll a(x);input(a);
#define VLL2(a,x,b,x_,...)vll a(x),b(x_);input(a,b);
#define VLL3(a,x,b,x_,c,x__,...)vll a(x),b(x_),c(x__);input(a,b,c);
#define VLL4(a,x,b,x_,c,x__,d,x___,...)vll a(x),b(x_),c(x__),d(x___);input(a,b,c,d);
#define VLL(...) overload8(__VA_ARGS__,VLL4,VLL0,VLL3,VLL0,VLL2,VLL0,VLL1)(__VA_ARGS__);
#define vrep(i,x) for(auto i:x)
#define vsrep(i,x) for(auto &i:x)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define Endl endl
#define endl "\n"

#endif
0