URAL 1971 Graphics Settings

首先是题意的理解,对着样例猜测一下把。。clockrate/generation_cycles=frame 大概是这个。。开启特效后cycle 会变大。 frame小于10或者大于等于60分为了3种情况。 然后哥去交了个int,反得re。其实呢是因为m有100000次操作每个factor的乘积会很大为了避免高精度参考学长有一个很巧妙的做法具体见代码维护一个队列,注意一些逻辑关系。
/*
    author:ray007great
    version:1.0
*/
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<cstdlib>
#include<cmath>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
/*  define */

#define sf(a) scanf("%d",&a)
#define sfs(a) scanf("%s",a)
#define sfI(a) scanf("%I64d",&a)
#define pf(a) printf("%d\n",a)
#define pfI(a) printf("%I64d\n",a)
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define rep1(i,a,b) for(int i=(a);i<(b);i++)
#define clr(a) memset(a,0,sizeof(a))
#define pfk  printf("fuck\n")

/*  define */
const int N = 110000;
map<string,int> idx;
queue<ll> q;
ll val[N],k,res,h,r,clock;
string kind,str;
bool vis[N],del[N],inq[N];
//use vis to avoid res divide the data undivded before
//use del to avoid use the data already deleted
//use inq to resprent if the data is inq now
string getStr(){
    int f=0;
    if(res*h*r*10>clock) return "Slideshow";
    while(!q.empty()){
        int now=q.front();
        q.pop();
        inq[now]=0;
        if(!del[now]){
            res*=val[now];
            vis[now]=1;
        }
        if(res*10*h*r>clock){
            f=1;
            break;
        }
    }
    if(f==1) return "Slideshow";
    if(res*h*r*60<=clock) return "Perfect";
    return "So-so";
}
int main(){
    int n,m;
    while(cin>>n){
        rep(i,1,n){
            cin>>kind>>k;idx[kind]=i;
            val[i]=k;
            q.push(i);inq[i]=1;
        }
        res=1;cin>>h>>r>>clock;
        cout<<getStr()<<endl;
        cin>>m;
        rep(i,1,m){
            cin>>str;
            if(str=="Off"){
                cin>>kind;
                int id=idx[kind];
                if(vis[id]){
                    res/=val[id];
                    vis[id]=0;
                }
                del[id]=1;
                cout<<getStr()<<endl;
                continue;
            }
            if(str=="On"){
                cin>>kind;
                int id=idx[kind];
                del[id]=0;
                if(!inq[id]) q.push(id);
                inq[id]=1;
                cout<<getStr()<<endl;
                continue;
            }
            if(str=="Resolution"){
                cin>>h>>r;
                cout<<getStr()<<endl;
            }
        }
    }
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值