比赛 期末考试2 评测结果 AAAAAAATTT
题目名称 物流 最终得分 70
用户昵称 ychyyx 运行时间 6.456 s
代码语言 C++ 内存使用 3.73 MiB
提交时间 2026-02-10 11:35:16
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m;
char opt;
int x,y;
int a[1000005];
int b[1000005];
bool cmp(int x,int y){
    return x>y;
}
int main(){
    freopen("logistics.in","r",stdin);
    freopen("logistics.out","w",stdout);
    scanf("%d%d",&n,&m);
    for(;m--;){
        cin>>opt;
        scanf("%d%d",&x,&y);
        if(opt=='U'){
            a[x]=y;
        }else{
            long long ans=0;
            for(int i=1;i<=n;i++){
                if(a[i]>=y) ans+=y;
                else    ans+=a[i];
            }
            if(ans>=(long long)(x*y)){
                printf("TAK\n");
            }else{
                printf("NIE\n");
            }
        }
    }
    return 0;
}