Codeforces 835C Codeforces Round #427 (Div. 2)
来源:互联网 发布:淘宝客做群推还有用吗 编辑:程序博客网 时间:2024/06/03 21:41
星星可以重叠!!!(。。。。)开三维向量存储星星,因为时间以(c+1)循环,三维数组记录不同时刻的不同行前缀和。。。
#include<bits/stdc++.h>using namespace std;typedef long long LL;LL ans[12][105][105];vector<LL> sky[105][105];LL n,q,c;LL x,y,s;LL t0,x11,y11,x22,y22;int main(){ while(~scanf("%lld%lld%lld",&n,&q,&c)) { memset(ans,0,sizeof(ans)); for(int i=0;i<101;i++) { for(int j=0;j<101;j++) sky[i][j].clear(); } for(int i=0;i<n;i++) { scanf("%lld%lld%lld",&x,&y,&s); sky[x][y].push_back(s); } for(int k=0;k<=c;k++) for(int i=1;i<=101;i++) { for(int j=1;j<=101;j++) { if(sky[i][j].size()>=1) { LL pp=0; for(int mm=0;mm<sky[i][j].size();mm++) { if(sky[i][j][mm]==-1) continue; LL xixi=(sky[i][j][mm]+k)%(c+1); pp+=xixi; } ans[k][i][j]=ans[k][i][j-1]+pp; } else ans[k][i][j]=ans[k][i][j-1]; } // cout<<ans[k][i][100]<<endl; } for(int i=0;i<q;i++) { LL res=0; scanf("%lld%lld%lld%lld%lld",&t0,&x11,&y11,&x22,&y22); for(int j=x11;j<=x22;j++) { LL pp=t0%(c+1); res+=ans[pp][j][y22]-ans[pp][j][y11-1]; } cout<<res<<endl; } }}
阅读全文
0 0
- Codeforces 835C Codeforces Round #427 (Div. 2)
- Codeforces Round #427 (Div. 2) C
- Codeforces Round #427 (Div. 2) C
- Codeforces Round #427 (Div.2) C
- Codeforces Round #427 (Div. 2) C D
- 【codeforces】Codeforces Round #370 (Div. 2) C
- Codeforces Round #427 (Div. 2)
- Codeforces Round #427 (Div. 2)
- Codeforces Round #427 (Div. 2)
- Codeforces Round #427 (Div. 2)
- Codeforces Round #427 (Div. 2)
- Codeforces Round #427 (Div. 2)
- Codeforces Round #427 (Div. 2)
- C. Star sky(Codeforces Round #427 (Div. 2) C)
- CodeForces-540C//Codeforces Round #301 (Div. 2)C BFS
- Codeforces Round #105 (Div. 2) C
- Codeforces Round 134 div 2 C题
- Codeforces Round #137 (Div. 2), problem: (C)
- mac 常用快捷键总结
- 关于Python中的不可变对象
- MVC之struts2
- DOM4J学习笔记 --- Node与Element区别
- Python 对象
- Codeforces 835C Codeforces Round #427 (Div. 2)
- 【HDU
- android 中assets和raw文件夹的异同:
- php程序员使用jquery的if判断易犯的一个错误总结
- HTML基础-1-网页组成-网页标准-浏览器与服务器关系-html概念-标签(单/双标签 图片标签)-路径-链接-特殊符号标记
- cookie简介
- Python 正则表达式
- laravel migration如何设置时间戳类型默认值为插入时间
- noi多维数组 11:图像旋转