比赛 期末考试2 评测结果 AAAAATTTTT
题目名称 物流 最终得分 50
用户昵称 梦那边的美好BP 运行时间 10.902 s
代码语言 C++ 内存使用 7.39 MiB
提交时间 2026-02-10 10:13:56
显示代码纯文本
#include <cstring>
#include <iostream>
using namespace std;
const int N = 1e6 + 6;
int a[N];
int b[N];
int main() {
    freopen("logistics.in", "r", stdin);
    freopen("logistics.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    while (m--) {
        char op;
        int x, y;
        cin >> op >> x >> y;
        if (op == 'U') {
            a[x] = y;
        } else {
            int cnt = 0;
            memset(b, 0, sizeof(b));
            while (cnt < y) {
                int s = 0;
                for (int i = 1; i <= n; i++) {
                    if (a[i] - b[i] > 0) {
                        s++;
                        b[i]++;
                        if (s == x) break;
                    }
                }
                if (s != x) break;
                cnt++;
            }
            if (cnt == y) {
                cout << "TAK\n";
            } else {
                cout << "NIE\n";
            }
        }
    }
    return 0;
}