比赛 期末考试2 评测结果 AAAAAAATTT
题目名称 物流 最终得分 70
用户昵称 rzzakioi 运行时间 6.588 s
代码语言 C++ 内存使用 3.68 MiB
提交时间 2026-02-10 10:27:43
显示代码纯文本
#include<iostream>
#define int long long
using namespace std;
int n,m,a[1000005];
signed main(){
    freopen("logistics.in","r",stdin);
    freopen("logistics.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        char op;
        int x,y;
        cin>>op>>x>>y;
        if(op=='U')a[x]=y;
        else{
            int sum=0,cnt=0;
            for(int i=1;i<=n;i++){
                if(a[i]>=y)cnt++;
                else sum+=a[i];
            }
            if(sum/y+cnt>=x)printf("TAK\n");
            else printf("NIE\n");
        }
    }
    return 0;
}