/ SB域 /

记录详情

Time Exceeded


  
# 状态 耗时 内存占用
#1 Accepted 2ms 316.0 KiB
#2 Accepted 3ms 2.312 MiB
#3 Accepted 2ms 2.324 MiB
#4 Accepted 2ms 2.312 MiB
#5 Accepted 522ms 20.379 MiB
#6 Accepted 850ms 204.0 KiB
#7 Accepted 1015ms 18.434 MiB
#8 Time Exceeded ≥2004ms ≥18.645 MiB
#9 Time Exceeded ≥2000ms ≥18.605 MiB
#10 Time Exceeded ≥2001ms ≥20.488 MiB
#11 Time Exceeded ≥2004ms ≥20.309 MiB
#12 Time Exceeded ≥2005ms ≥20.473 MiB
#13 Time Exceeded ≥2004ms ≥20.453 MiB
#14 Time Exceeded ≥2004ms ≥16.371 MiB
#15 Time Exceeded ≥2001ms ≥20.398 MiB
#16 Time Exceeded ≥2001ms ≥18.586 MiB
#17 Time Exceeded ≥2000ms ≥20.5 MiB
#18 Time Exceeded ≥2001ms ≥18.598 MiB
#19 Time Exceeded ≥2002ms ≥20.328 MiB
#20 Time Exceeded ≥2002ms ≥20.316 MiB
#21 Time Exceeded ≥2000ms ≥26.668 MiB
#22 Time Exceeded ≥2001ms ≥26.543 MiB
#23 Time Exceeded ≥2001ms ≥28.332 MiB
#24 Time Exceeded ≥2000ms ≥26.453 MiB
#25 Time Exceeded ≥2005ms ≥28.309 MiB

代码

# include <bits/stdc++.h>
# define int long long 
using namespace std;
const int MAXN=5005;
int a[MAXN][MAXN],n,m;
inline int read()
{
    int X=0,w=0;char c=0;
    while (!(c>='0'&&c<='9')) w|=c=='-',c=getchar();
    while ((c>='0'&&c<='9')) X=(X<<1)+(X<<3)+(c^48),c=getchar();
    return w?-X:X;
}
inline void write(int x)
{
    if (x<0) { putchar('-'); x=-x;}
    if (x>9) write(x/10);
    putchar('0'+x%10);
}
inline void writeln(int x){write(x);putchar('\n');}
inline void work1()
{
    int ans=0;
    int x1,y1,x2,y2;
    x1=read(),y1=read(),x2=read(),y2=read();
    for (int i=x1;i<=x2;i++)
     for (int j=y1;j<=y2;j++)
      ans+=a[i][j];
    writeln(ans);
}
inline void work2()
{
    int x1,y1,x2,y2,d;
    x1=read(),y1=read(),x2=read(),y2=read(),d=read();
    for (int i=x1;i<=x2;i++)
     for (int j=y1;j<=y2;j++)
      a[i][j]+=d;
}
inline void work3()
{
    int x1,y1,x2,y2,d;
    x1=read(),y1=read(),x2=read(),y2=read(),d=read();
    for (int i=x1;i<=x2;i++)
     for (int j=y1;j<=y2;j++)
      a[i][j]-=d;
}
inline void work4()
{
    int x,y;
    x=read();y=read();
    writeln(a[x][y]);
}
signed main()
{
    n=read();m=read();
    for (int i=1;i<=n;i++)
     for (int j=1;j<=m;j++)
      a[i][j]=read();
    char opt;  
    while (true) {
        cin>>opt;
        switch (opt) {
            case 'Q':work1();break;
            case 'A':work2();break;
            case 'D':work3();break;
            case 'F':work4();break;
            case 'E':goto exit;break;
        }
    }  
    exit:;
    return 0;
}

信息

递交者
类型
递交
题目
二维数列 (U50446)
题目数据
下载
语言
C++
递交时间
2018-11-05 13:38:32
评测时间
2018-11-05 13:38:32
评测机
分数
28
总耗时
≥38445ms
峰值内存
≥28.332 MiB