社区讨论

萌新求助qaq

P5284[十二省联考 2019] 字符串问题参与者 5已保存回复 7

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
7 条
当前快照
1 份
快照标识符
@mi7xhdo7
此快照首次捕获于
2025/11/21 05:13
4 个月前
此快照最后确认于
2025/11/21 05:13
4 个月前
查看原帖
RT 全部RE
CPP
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;

const int N = 500010;
typedef long long ll;

int val[N << 3], tot;

inline long long qpow(int x,int y){
    if (!y) return 1;
    long long t=qpow(x,y/2);
    t=(long long)t*t;
    if (y%2) t=(long long)t*x;
    return t;
}

#define reg register

struct control{
    int ct,val;
    control(int Ct,int Val=-1):ct(Ct),val(Val){}
    inline control operator()(int Val){
        return control(ct,Val);
    }
}_endl(0),_prs(1),_setprecision(2);

#define endl _endl
#define prs _prs
#define setprecision _setprecision

struct FastIO{
    #define IOSIZE 1000000
    char in[IOSIZE],*p,*pp,out[IOSIZE],*q,*qq,son[100],*t,b,K,prs;
    FastIO():p(in),pp(in),q(out),qq(out+IOSIZE),t(son),b(1),K(6){}
    ~FastIO(){fwrite(out,1,q-out,stdout);}
    inline char getch(){
        return p==pp&&(pp=(p=in)+fread(in,1,IOSIZE,stdin),p==pp)?b=0,EOF:*p++;
    }
    inline void putch(char x){
        q==qq&&(fwrite(out,1,q-out,stdout),q=out),*q++=x;
    }
    inline void puts(const char str[]){fwrite(out,1,q-out,stdout),fwrite(str,1,strlen(str),stdout),q=out;}
    inline void getline(string& s){
        s="";
        for(reg char son;(son=getch())!='\n'&&b;)s+=son;
    }
    #define indef(T) inline FastIO& operator>>(T& x){\
        x=0;reg char f=0,son;\
        while(!isdigit(son=getch())&&b)f|=son=='-';\
        while(isdigit(son))x=(x<<1)+(x<<3)+(son^48),son=getch();\
        return x=f?-x:x,*this;\
    }
    indef(int)
    indef(long long)
    inline FastIO& operator>>(char& son){return son=getch(),*this;}
    inline FastIO& operator>>(string& s){
        s="";reg char son;
        while(isspace(son=getch())&&b);
        while(!isspace(son)&&b)s+=son,son=getch();
        return *this;
    }
    inline FastIO& operator>>(char* s){
        memset(s,0,sizeof s);reg char son;reg int tot=0;
        while(isspace(son=getch())&&b);
        while(!isspace(son)&&b) s[tot++]=son,son=getch();
        return *this;
    }
    inline FastIO& operator>>(double& x){
        x=0;reg char f=0,son;
        double d=0.1;
        while(!isdigit(son=getch())&&b)f|=(son=='-');
        while(isdigit(son))x=x*10+(son^48),son=getch();
        if(son=='.')while(isdigit(son=getch()))x+=d*(son^48),d*=0.1;
        return x=f?-x:x,*this;
    }
    #define outdef(_T) inline FastIO& operator<<(_T x){\
        !x&&(putch('0'),0),x<0&&(putch('-'),x=-x);\
        while(x)*t++=x%10+48,x/=10;\
        while(t!=son)*q++=*--t;\
        return *this;\
    }
    outdef(int)
    outdef(long long)
    outdef(unsigned)
    outdef(unsigned long long)
    inline FastIO& operator<<(char son){return putch(son),*this;}
    inline FastIO& operator<<(const char str[]){return puts(str),*this;}
    inline FastIO& operator<<(const string& s){return puts(s.c_str()),*this;}
    inline FastIO& operator<<(double x){
        reg int k=0;
        this->operator<<(int(x));
        putch('.');
        x-=int(x);
        prs&&(x+=5*qpow(10,-K-1));
        while(k<K)putch(int(x*=10)^48),x-=int(x),++k;
        return *this;
    }
    inline FastIO& operator<<(const control& cl){
        switch(cl.ct){
            case 0:putch('\n');break;
            case 1:prs=cl.val;break;
            case 2:K=cl.val;break;
        }
    }
    inline operator bool(){return b;}
}io;

struct gra {
    struct edge {
        edge *nxt;
        int to;
    } pool[N << 3], *pt[N << 3], *p = pool;
    void init(int n) {
        for (int i = 1; i <= n; i++) pt[i] = NULL;
        p = pool;
    }
    inline void addedge(int a, int b) { *(++p) = (edge){ pt[a], b }, pt[a] = p; }
} g;

typedef gra::edge edge;

回复

7 条回复,欢迎继续交流。

正在加载回复...