比赛 |
ZLXOI2015Day1 |
评测结果 |
AAAAAAAAAA |
题目名称 |
虐狗大赛 |
最终得分 |
100 |
用户昵称 |
Binary10 |
运行时间 |
0.273 s |
代码语言 |
C++ |
内存使用 |
2.61 MiB |
提交时间 |
2015-10-29 11:54:14 |
显示代码纯文本
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cmath>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
const int maxn = 100100;
struct Event{
int a, b, c, d;
}events[maxn];
int h[maxn], d[maxn], n;
int q;
int main()
{
freopen("thebigmatch.in", "r", stdin);
freopen("thebigmatch.out", "w", stdout);
cin >> n;
for(int i = 1; i <= n; i++)
scanf("%d", &h[i]);
for(int i = 1; i <= n; i++)
scanf("%d", &d[i]);
cin >> q;
int op, x, y, z;
memset(events, 0, sizeof(events));
for(int i = 1; i <= q; i++){
scanf("%d", &op);
if(op == 0){
scanf("%d%d%d", &x, &y, &z);
events[x].a += z;
events[y].b += z;
events[x].c++;
events[y].d++;
}
else if(op == 1){
int k = 0, p = 0;
for(int i = 1; i <= n; i++){
k += events[i].a;
p += events[i].c;
h[i] -= (k - p * d[i]);
printf("%d ", h[i]);
k -= events[i].b;
p -= events[i].d;
}
puts("");
memset(events, 0, sizeof(events));
}
}
return 0;
}