比赛 期末考试2 评测结果 AAAAAAATTT
题目名称 物流 最终得分 70
用户昵称 赵飞羽 运行时间 6.469 s
代码语言 C++ 内存使用 3.72 MiB
提交时间 2026-02-10 09:03:51
显示代码纯文本
#include <bits/stdc++.h>
#define int unsigned long long
using namespace std;

const int N = 1000010;
int n, m, a[N], x, y, cnt, sum;
char op;

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++) {
        cin >> op >> x >> y;
        if (op == 'U') {
            a[x] = y;
        } else {
            cnt = 0, sum = 0;
            for (int j = 1; j <= n; j++) {
                cnt += ((a[j] > y)? y: a[j]);
                sum += ((0 < a[j])? 1: 0);
            }
            cout << ((double((double)cnt / (double)x) >= y && sum >= x)? "TAK\n": "NIE\n");
        }
    }
    return 0;
}