标签:des style http java color os
暴力...
1 3 2 1 2 1 3 6 0 1 15 0 3 4 1 1 1 3 0 2 33 1 2
4 15 15
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
const int maxn=110000;
vector<int> g[maxn];
int n,m;
int du[maxn];
int main()
{
int T_T;
scanf("%d",&T_T);
while(T_T--)
{
scanf("%d%d",&n,&m);
for(int i=0;i<=n+10;i++)
g[i].clear(),du[i]=0;
for(int i=0;i<m;i++)
{
int a,b;
scanf("%d%d",&a,&b);
g[a].push_back(b);
g[b].push_back(a);
}
int q;
scanf("%d",&q);
while(q--)
{
int c,a,b;
scanf("%d",&c);
if(c==0)
{
scanf("%d%d",&a,&b);
du[a]+=b;
}
else
{
scanf("%d",&a);
int ret=0;
for(int i=0,sz=g[a].size();i<sz;i++)
ret+=du[g[a][i]];
printf("%d\n",ret);
}
}
}
return 0;
}
标签:des style http java color os
原文地址:http://blog.csdn.net/ck_boss/article/details/38016067