花瓶 暴力

来源:互联网 发布:retas studio for mac 编辑:程序博客网 时间:2024/04/30 18:46

然而裸暴力也能有70分

#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<cstdlib>#include<algorithm>#define LL long long#define fo(i,a,b) for(int i=a;i<=b;i++)#define dfo(i,a,b) for(int i=a;i>=b;i--)using namespace std;inline LL read(){LL d=0,f=1;char s=getchar();while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}while(s>='0'&&s<='9'){d=d*10+s-'0';s=getchar();}return d*f;}#define N 100005bool a[N];int n,m;int main(){freopen("vase.in","r",stdin);freopen("vase.out","w",stdout);memset(a,0,sizeof(a));n=read(),m=read();fo(i,1,m){int ch=read(),x=read(),y=read();if(ch==1){int first=-1,last=-1;fo(j,x,n-1)if(a[j]==0&&y){if(first<0)first=j;last=max(j,last);a[j]=1;y--;}if(first+last<0)puts("Can not put any one.");else printf("%d %d\n",first,last);}else{int ret=0;fo(j,x,y)if(a[j]==1){a[j]=0;ret++;}printf("%d\n",ret);}}return 0;}


0 0
原创粉丝点击