zoukankan      html  css  js  c++  java
  • 【TMD模拟赛】黄金拼图 Cao

    正解:Cao

    据说这样的题是用来骗丛林生物上树的......

    这样的题除了考观察力之外还.........我们发现他异或了opt,恩,就这样,用离线推答案.....

    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    const int N=200020;
    int n,k,m,s[N],last_l,last_r;
    inline bool is(int x){
      for(int i=2;i*i<=x;++i)
        if(x%i==0)return false;
      return true;
    }
    int main(){
      scanf("%d%d%d",&n,&k,&m);
      for(int i=1;i<=n;++i)
        scanf("%d",&s[i]);
      int need=0;
      for(int i=1;i<=m;++i){
        int opt,x,y;
        scanf("%d%d%d",&opt,&x,&y);
        if(opt==1){last_l=x,last_r=y,need=1;continue;}
        if(opt==2){s[x]=y;continue;}
        if(opt&1){
          if(need)printf("%d
    ",opt^2),need=0;
          s[x^(opt^2)]=y^(opt^2);
        }else{
          if(need)printf("%d
    ",opt^1),need=0;
          last_l=x^(opt^1),last_r=y^(opt^1),need=1;
        }
      }
      if(need){
        std::sort(s+last_l,s+(last_r+1));
        for(int i=last_l;i<=last_r;++i)
          if(is(s[i])){
            --k;
            if(k==0){
              printf("%d
    ",s[i]);
              break;
            }
          }
      }
      return 0;
    }
  • 相关阅读:
    oracle查看锁表及解锁
    二、web综合开发
    一、springboot入门
    oracle行转列及分组排序
    awk命令--转
    oracle 游标
    HttpServletRequestWrapper类的使用
    rabbitMQ
    java(其他)面试要点7
    java(框架)面试要点6
  • 原文地址:https://www.cnblogs.com/TSHugh/p/7617753.html
Copyright © 2011-2022 走看看