| 比赛 |
期末考试2 |
评测结果 |
AAAAAAATTT |
| 题目名称 |
物流 |
最终得分 |
70 |
| 用户昵称 |
dbk |
运行时间 |
6.495 s |
| 代码语言 |
C++ |
内存使用 |
3.67 MiB |
| 提交时间 |
2026-02-10 11:32:23 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, m, cnt;
int a[N], bb[N];
char op;
bool summarize(int c, int s){
long long sum = 0, mi = 0/*操作总数*/, z = 0;
for(int i = 1;i <= n;i++){
sum += a[i];
mi += min(a[i], s);
if(a[i] > 0) z++;
}
if(z >= c && sum >= c * s && mi >= c * s) return 1;
else return 0;
}
int main(){
freopen("logistics.in", "r", stdin);
freopen("logistics.out", "w", stdout);
scanf("%d %d", &n, &m);
while(m--){
cin >> op;
if(op == 'U'){
int x, b;
scanf("%d %d", &x, &b);
a[x] = b;
}
else{
int c, s, ans = 0;
scanf("%d %d", &c, &s);
if(summarize(c, s)) printf("TAK\n");
else printf("NIE\n");
}
}
}