萌新搞不懂输入了
查看原帖
萌新搞不懂输入了
428993
ccccccyd楼主2023/2/19 16:14

救命

代码打完之后

输入数据

发现无法读入

本蒟蒻是已经连读入都不会了吗...

#include <bits/stdc++.h>
#define ord(i,l,r) for(register int i=l;i<=r;++i)
#define dord(i,r,l) for(register int i=r;i>=l;--i)
using namespace std;


namespace Maker {

typedef unsigned int uit;

bool __sp;
uit __x, __y, __z;
int __type, __k, __m;

const int L = 1 << 21;
char buf[L], *front=buf, *end=buf;
char GetChar() {
  if (front == end) {
    end = buf + fread(front = buf, 1, L, stdin);//我的程序卡在这一行了
    if (front == end) return -1;
  }
  return *(front++);
}

template <typename T>
inline void qr(T &x) {
  char ch = GetChar(), lst = ' ';
  while ((ch > '9') || (ch < '0')) lst = ch, ch = GetChar();
  while ((ch >= '0') && (ch <= '9')) x = (x << 1) + (x << 3) + (ch ^ 48), ch = GetChar();
  if (lst == '-') x = -x;
}

template <typename T>
inline void Begin(const T &x) {
  __type = x % 10;
  qr(__x); qr(__y); qr(__z); qr(__m);
  __sp = (__type == 3) || (__type == 4); __type &= 1;
}

inline uit __Next_Integer() {
  __x ^= __y << (__z & 31);
  __y ^= __z >> (__x & 31);
  __z ^= __x << (__y & 31);
  __x ^= __x >> 5; __y ^= __y << 13; __z ^= __z >> 6;
  return __x;
}

inline uit Rand() { return __Next_Integer(); }

template <typename Tx, typename Ty, typename Tz>
inline void Get_Nextline(Tx &x, Ty &y, Tz &z) {
  if (__m) {
    --__m;
    x = 0; y = 0; z = 0;
    qr(x); qr(y); qr(z);
    if (x == 0) ++__k;
  } else {
    x = Rand() & 1; y = Rand() & 1;
    if (__k == 0) { x = 0; }
    if (x == 0) {
      ++__k;
      if (__sp) {
        z = __type;
      } else {
        z = Rand() & 1;
      }
    } else {
      int dk = __k >> 1;
      if (dk == 0) {
        z = 1;
      } else {
        z = Rand() % dk + dk;
      }
    }
  }
}

}



const int N=1e7+20;
struct ask{int x,y,z;} a[N];
int n,id[N],l0[N],r0[N],L,R,L0,R0;
int main() {

	scanf("%d", &n);
	Maker::Begin(n);
	int l=1,r=0;
	for(int x,y,z,i=1;i<=n;++i) {
		Maker::Get_Nextline(x, y, z);
    	a[i]=(ask){x,y,z};
    	l0[i]=n+3,r0[i]=-2;
		if(x==0) r++;
	}
	dord(i,n,1) if(a[i].x==0){ if(a[i].y==0) id[i]=l++; else id[i]=r--; } 
	int v,w,len,ans1=0,ans2=0,ans3=0,ans4=0;
	L0=n+3,R0=-2,L=0,R=n+1;
	ord(i,1,n){
		if(a[i].x==0){
			if(a[i].y==0){
				if(a[i].z==0) ord(j,L,L0-1) l0[j]=id[i];
				else r0[id[i]]=L0;
			}else{
				if(a[i].z==0) ord(j,R0+1,R) r0[j]=id[i];
				else l0[id[i]]=R0;
			}
			if(a[i].z==0) L0=min(L0,id[i]),R0=max(R0,id[i]);
			L=min(L,id[i]),R=max(R,id[i]);
		}else{
			if(a[i].y==0){
				v=L+a[i].z-1,w=(l0[v]!=n+3)?l0[v]:L,len=v-w+1;
				if(w!=L) len++;
			}else{
				v=R-a[i].z+1,w=(r0[v]!=-2)?r0[v]:R,len=w-v+1;
				if(w!=R) len++;
			}
			if(len&1){
				ans1++;
				if(i%2==0) ans3++;
			}else{
				if(i&1) ans2++;
				if(i%1024==0) ans4++;		
			}
		}
	}
	return 0;
}
```cpp
2023/2/19 16:14
加载中...