<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>codevs on The Site of laekov</title>
    <link>/tags/codevs/</link>
    <description>Recent content in codevs on The Site of laekov</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <copyright>&amp;copy; laekov</copyright>
    <lastBuildDate>Sat, 18 Oct 2014 17:06:28 +0000</lastBuildDate><atom:link href="/tags/codevs/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>CodeVS3147 矩阵乘法2</title>
      <link>/oi/lofterimport_138/</link>
      <pubDate>Sat, 18 Oct 2014 17:06:28 +0000</pubDate>
      
      <guid>/oi/lofterimport_138/</guid>
      <description>居然继续沦落到写CV的题解的地步了。
这又是一道坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑坑题。
思路很简单。就是记a的列前缀和和b的行前缀和，每次询问的时候O(n)的扫一遍乘积累和。
但是，极限数据本地要跑3.2s。虽然我笔记本是慢，但是也不能这样玩我啊。交了好久都在tle。
最后想到一个常数优化的办法。因为每次是把一行或者一列的数都访问一遍，所以用一个指针把数组的那一行记下来。这样寻址会快一些。事实证明快了不只一些。
坑，哈哈。
#include &amp;lt;cstdio&amp;gt;
#include &amp;lt;cctype&amp;gt;
#include &amp;lt;memory.h&amp;gt;
#include &amp;lt;algorithm&amp;gt;
using namespace std;
typedef long long qw;
#ifdef WIN32
#define lld &amp;quot;%I64d&amp;quot;
#else
#define lld &amp;quot;%lld&amp;quot;
#endif
#define _l (qw)
#define readInt(_s_)&amp;nbsp;{\
int _d_;\
_s_ = 0;\
while (!isdigit(_d_&amp;nbsp;= getchar()));\
while ((_s_&amp;nbsp;= _s_ * 10 + _d_ - 48), isdigit(_d_ = getchar()));\
}
const int maxn = 2001;
int a[maxn][maxn], b[maxn][maxn], n, m;
int main()&amp;nbsp;{
readInt(n);</description>
    </item>
    
  </channel>
</rss>
