CSP 2021 浙江迷惑行为大赏

· · 个人记录

写在前面

退役了.

url 中的傻逼 指我

对上镜的同学们无恶意

CSP-J

逆 行 者

#include<bits/stdc++.h>
using namespace std;
int main(){
    freopen("candy.in","w",stdin);
    freopen("candy.out","r",stdout);
    ...
}
#include<bits/stdc++.h>
using namespace std;
int main(){
    freopen("fruit.in","w",stdin);
    freopen("fruit.out","r",stdout)
    ...
}
#include<bits/stdc++.h>
using namespace std;
int main(){
    freopen("sort.in","w",stdin);
    freopen("sort.out","r",stdout);
    ...
}

以上代码均来自 ZJ-00072 这位老哥

半 个 逆 行 者

freopen("sort.in","r",stdin);
freopen("sort.in","w",stdout);

注 释 人

正 义 制 裁 人

口 吐 芬 芳 人

考 场 游 记 人

扩 展 名 混 用 人

freopen("sort.txt","r",stdin);
freopen("sort.out","w",stdout);
freopen("network.in","r",stdin);
freopen("network.txt","w",stdout);

担心 ccf 没数据提交了数据生成器

正 则 乱 杀 人 (这个应该不算迷惑行为?)

面 向 对 象 人

class Address {
public:
    int ip1, ip2, ip3, ip4, port;
};

class Format {
private:
    int stringToInt(string s) {
        int res = 0, len = s.size();
        for (int i = 0; i < len; i++) {
            res = res * 10 + (s[i] - '0');
        }
        return res;
    }

    bool checkIp(int ip) {
        if (0 <= ip && ip <= 255) return true;
        return false;
    }

    bool checkPort(int port) {
        if (0 <= port && port <= 65535) return true;
        return false;
    }
public:
    bool checkAddr(string s) {
        string split[10];
        int cur = 0, len = s.size();
        int c1 = 0, c2 = 0;
        for (int i = 0; i < len; i++) {
            if (s[i] == '.') {
                cur++;
                c1++;
            } else if (s[i] == ':') {
                cur++;
                c2++;
            } else {
                split[cur] += s[i];
            }
            if (cur > 4) return false;
        }
//      cout << endl << c1 << endl << c2 << endl;
        if (c1 != 3 || c2 != 1) return false;
        Address res;
        for (int i = 0; i < 5; i++) {
            if (split[i].size() > 1) {
                if (split[i][0] == '0') return false;
            }
            if (split[i].size() > 6) return false;
            if (split[i].size() == 0) return false;
        }
        res.ip1 = stringToInt(split[0]);
        res.ip2 = stringToInt(split[1]);
        res.ip3 = stringToInt(split[2]);
        res.ip4 = stringToInt(split[3]);
        res.port = stringToInt(split[4]);
        return (checkIp(res.ip1) 
            && checkIp(res.ip2) 
            && checkIp(res.ip3) 
            && checkIp(res.ip4) 
            && checkPort(res.port));
    }

    Address parseAddr(string s) {
        string split[10];
        int cur = 0, len = s.size();
        for (int i = 0; i < len; i++) {
            if (s[i] == '.' || s[i] == ':') {
                cur++;
            } else {
                split[cur] += s[i];
            }
        }
        Address res;
        res.ip1 = stringToInt(split[0]);
        res.ip2 = stringToInt(split[1]);
        res.ip3 = stringToInt(split[2]);
        res.ip4 = stringToInt(split[3]);
        res.port = stringToInt(split[4]);
        return res;
    }
} format;

class Network {
private:
    map<string, int> servers;
public:
    int create(string addr, int id) {
        if (format.checkAddr(addr) == false) return 0;
        if (servers[addr] != 0) return 1;
        servers[addr] = id;
        return 2;
    }

    int connect(string addr) {
        return servers[addr];
    }
} network;

CSP-S

手 足 无 措 人

bool check(string s){
    /*
    我连暴力都不知道怎么写check了qwq
    */

    return is_CCF_du_liu;
}

友 善 指 导 人

知道我可能打开会乱码 "如果看到奇怪乱码 切换编码方式"

呜呜

玉 碎 人

auto out = [&] {
    cout << "宁为玉碎,不为瓦全。" << endl;
    cout << "良心CCF" << endl; 
    return -1;
};

求 你 了

//他妈两个小时了还没调通样例 
//仔细一看发现比想象中复杂很多     
//写完了调好了记得取消输出重定向的注释 
//#include<bits/stdc++.h>
//using namespace std;
//#define max_ 100010
//int n,m1,m2,m12,m22,leave_time[max_],ans=0,maxans=0;
//bool fp[max_];//记录被分配了廊桥的飞机 
//struct jiegouti{
//    int time,arr=0;
//    bool arriveorleave=false;//arrive=true,leave=false
//}guonei[max_],guoji[max_];
//bool cmp(jiegouti a,jiegouti b){return a.time<b.time;}//时间早的在前 
//struct s{ /* 所有 a1,i, b1,i, a2,i, b2,i 为数值不超过 10^8 的互不相同的正整数。 */
//  int arrive,leave;
//}guonei[maxm],guoji[maxm];
//bool cmp(s a,s b){return a.arrive<b.arrive;}//先到先得 来得早的排在前面 
//int main(){
    /* 从文件 airport.in 中读入数据。 */
//    freopen("airport1.in","r",stdin);//ans should be 4 6 7 5
    /* 从文件 airport.in 中读入数据。 */
    /* 输出到文件 airport.out 中。 */
//    freopen("airport.out","w",stdout);
    /* 输出到文件 airport.out 中。 */
//    scanf("%d%d%d",&n,&m1,&m2);
//    m12=m1+m1,m22=m2+m2;
//    for(int i=0;i<m1;i+=2){//输入和处理国内部分 
//      scanf("%d%d",&guonei[i].time,&guonei[i+1].time);
//      guonei[i].arriveorleave=true;
//      guonei[i+1].arr=guonei[i].time;
//  }
//    for(int i=0;i<m2;i+=2){//输入和处理国际部分 
//      scanf("%d%d",&guoji[i].time,&guoji[i+1].time);
//      guoji[i].arriveorleave=true;
//      guoji[i+1].arr=guoji[i].time;
//  }
//    sort(guonei,guonei+m12,cmp); 
//    sort(guoji,guoji+m22,cmp);
//    for(int i=0;i<m12;i++){
//      
//  }
//    for(int i=0;i<=n;i++){//暴力:i个给国内n-i个给国际 
//      ans=0;
//      int guo_nei=i,guo_ji=n-i;//表示剩余可分配的廊桥数量 控制不小于0 
//      cout<<"[Debug] guonei has "<<guo_nei<<" while guoji has "<<guo_ji<<endl;
//      memset(fp,false,sizeof(fp));
//      for(int j=0;j<m1+m1;j++){
//          if(j==0&&guo_nei==0) break;
//          if(guonei[j].arriveorleave){//到/arrive 
//              if(guo_nei){
//                  guo_nei--;
//                  ans++;//有位置就分配位置 答案+1 
//                  fp[guonei[j].time]=true;//分配标记 
//                  cout<<"[Debug] <arrive> fp["<<guonei[j].time<<"]guonei got "<<guo_nei<<" seat(s) left, ans="<<ans<<endl;
//              }
//              else{
//                  decline[guonei[j].time]=true;//没位置可分配就标注一下 以免多退还位置 
//                  cout<<"[Debug] declined guonei["<<j<<"]("<<guonei[j].time<<"): no seat left"<<endl;
//              }
//          }else{//离开 退还位置 
//              if(fp[guonei[j].arr]){//查询这架飞机是不是停在廊桥 
//                  guo_nei++;//如果之前的确给这架飞机分配了廊桥 那么回收可用廊桥数量 
//                  cout<<"[Debug] plane "<<j<<" just left. guoji bridge remaining "<<guo_ji<<endl;
//              }//否则什么也不做 
//          }
//      }
//      cout<<"[Debug] guonei final ans="<<ans<<endl;
//      memset(fp,false,sizeof(fp));
//      for(int j=0;j<m12;j++){
//          if(j==0&&guo_ji==0) break;
//          if(guoji[j].arriveorleave){//到/arrive 
//              if(guo_ji){//有位置就分配位置 答案+1 
//                  guo_ji--;
//                  ans++;
//                  cout<<"[Debug] guoji got "<<guo_ji<<" seat(s) left,ans now is "<<ans<<endl;
//              }else{
//                  decline[guoji[j].time]=true;//没位置可分配就标注一下 以免多退还位置 
//                  cout<<"[Debug] declined guoji["<<j<<"]("<<guoji[j].time<<"): no seat left"<<endl;
//              }
//          }else{//离开 退还位置 
//              if(fp[guoji[j].arr]){
//                  guo_ji++;//如果之前的确给这架飞机分配了廊桥 那么回收可用廊桥数量 
//                  cout<<"[Debug] plane "<<j<<" just left. guoji bridge remaining "<<guo_ji<<endl;
//              }//否则什么也不做 
//          }
//      }
//      cout<<"[Debug] guoji final ans="<<ans<<endl<<endl;
//      if(ans>maxans) maxans=ans;
//  }
//  cout<<maxans;
//    for(int i=0;i<m;i++) printf("%d %d\n",p[i].arrive,p[i].leave);
//  return 0;
//}
//m1 m2 国内国际必须区分不能混一起 
//~~结束时间早的在前~~ 不行
//      guonei[i].id=guonei[i].id=;     你是傻逼吗 不会用开始的时间当下标? 
//表示无法分配廊桥的飞机的到达时间 
/* 我直接重写 */ 
/* 思路:对于每个时间点统计廊桥使用情况 */
/* 预计最坏情况下占用内存390MB左右 short类型占用减半(应该) */
/* shorts实际占用约196.504MB */ 
/* 还有 1.5h 还有机会 */ 
/* 问题在于有国内和国际两拨 还要枚举 */
//#include<bits/stdc++.h>
//#include<windows.h>
//using namespace std;
//short situation[100000000];
//int n,m1,m2;
//int main(){
//  scanf("%d%d%d",&n,&m1,&m2);
//  for(int i=1;i<=m1;i++){
//      scanf("")
//  }
//  for(int i=1;i<=m2;i++){
//  }
//  return 0;
//}
//  memset(situation,1,sizeof(situation));
//  for(int i=0;i<=100000000;i++) situation[i]=rand(); 
//  cout<<"[Debug] Memset Finished."<<endl;
//  Sleep(3000);

美 元 人

struct ${int l,r;char operator<($ b) const {return l<b.l;}}a[N],b[N];

来自小跳蛙的投稿

凯 厨

// Kal'tsit /qq

来自 @_ztyqwq 的投稿

摆 烂 人 && 宏 定 义 人

#define rg(x) for(int i=1;i<=(x);i++){
#define rg_(i,x) for(int i=1;i<=(x);i++){
#define rrg(x) for(int i=0;i<(x);i++){
#define gr }
#define odl(x) printf("%d\n",x)
#define odb(x) printf("%d ",x)
#define oldl(x) printf("%lld\n",x)
#define oldb(x) printf("%lld ",x)
/*结束了。

最后还是没有成功。

希望1=吧。

没有任何希望再多一点分了。

来不及打网络流暴力(?)了

T2浪费了太久。

可惜。
那么。
devinwang txdy!
zhoukangyang tsdy!
stO dead_X Orz!
stO L Orz!
stO hehezhou Orz!
*/
int main()
{
    return 0;//the end.
}

来自 @cmll02 的投稿

linux 人

// system("shutdown -s -t 1");

菜 谱 人

请帮我写代码

#include<stdio.h>
#define int long long
#define rep(i,j,k) for(int i = j; i <= k; ++i)
#define nrep(i,j,k) for(int i = j; i >= j; ++i)

FILE *fin, *fout;
int read() {
  int flag = 1, res;
    char c;
    while((c = fgetc(fin)) < '0' || c > '9') if(c == '-') flag = -1;
    res = c - 48;
    while((c = fgetc(fin)) >= '0' && c <= '9') res = (res << 3) + (res << 1) + c - 48;
    return res * flag;
}
void print(int x) {
    fprintf(fout, "%lld", x);
}

signed main() {
    #ifdef debug
      fin = stdin;
        fout = stdout;
    #else
      fin = fopen("traffic.in", "r");
      fout = fopen("traffic.out", "w");
    #endif

    puts("Sorry, But I Cannot Solve This Task.");
    puts("Could You Give Me Some Points?");
    puts("Alright, You CCF(€€£) Do Not Have Much Money,");
    puts("So You Won't Give Me More Score Right?");
    puts("OK.I Will Only Write The File Opration.");
    puts("Please Write The Rest Of The Programme For Me,");
    puts("Thanks For You Coopration.Goodbye.");

    return 0;
}

担心 ccf 的 o2 是假的 自己再开一遍

上 单 人

while(t--)
{
    cout<<"ccf 马什么时候死啊?"<<endl;
}

苟 利 国 家 生 死 以

祝 福 人

#include<bits/stdc++.h>
#define DB double
#define LL long long
#define MKP make_pair
#define UB upper_bound
#define LB lower_bound
#define MS(x,y) memset(x,y,sizeof(x))
#define cms printf("%.2lf\n",(&o2-&o1)/1024.0/1024);
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
using namespace std;
char IO;
int Rd(){
    int _s_=0;
    bool _f_=0;
    while(IO=getchar(),IO<48||IO>57)
        IO=='-'&&(_f_=1);
    do _s_=(_s_<<1)+(_s_<<3)+(IO^48);
    while(IO=getchar(),IO>47&&IO<58);
    return _f_?-_s_:_s_;
}
int main(){
    freopen("traffic.in","r",stdin);
    freopen("traffic.out","w",stdout);
    puts("祝各位都能考好,以梦为马,不负韶华"); 
    return 0;
}

送 钱 人

// I am a juruo.
// stO CCF Orz
/*
while (true) {
    CCF's_money++;
    My_money--;
}
*/