NOIP T2
  • 板块学术版
  • 楼主_Archive_
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/11/18 21:37
  • 上次更新2023/11/18 22:56:20
查看原帖
NOIP T2
484894
_Archive_楼主2023/11/18 21:37

请问3 4点为什么有时候wa 有时候A

#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline int read(){
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
	return s*w;
}
const int N=1e5+10;
const int inf=1e9+10;
struct node{
	char c;
	int x,y;
}op[N];
int n,m,ans=1e5+10;
int a[N],b[N];
void work2(){
	int res=0;
	for(int i=1;i<=m;i++){
		int t=op[i].x;
		if(op[i].c=='T') a[t]=1;
		else if(op[i].c=='F') a[t]=2;
		else if(op[i].c=='U') a[t]=3;
	}
	for(int i=1;i<=n;i++){
		if(a[i]==3) res++; 
		a[i]=0;
	}
	printf("%d\n",res);
}
int main(){
//	freopen("tribool.in","r",stdin);
//	freopen("tribool.out","w",stdout);
	int c=read(),t=read();
	while(t--){
		n=read(),m=read(),ans=inf;
		for(int i=1;i<=m;i++){
			cin>>op[i].c;
			if(op[i].c=='T'||op[i].c=='F'||op[i].c=='U'){
				op[i].x=read(),op[i].y=0;
			}
			else op[i].x=read(),op[i].y=read();
		}
		if(c==3||c==4) work2();
	}
	return 0;
}
2023/11/18 21:37
加载中...