QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#402165#1076. Flooding Fieldsstasio6#WA 9ms7824kbC++141.4kb2024-04-30 02:56:482024-04-30 02:56:49

Judging History

你现在查看的是最新测评结果

  • [2024-04-30 02:56:49]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:7824kb
  • [2024-04-30 02:56:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define rep(i,a,b) for(int i = a; i < (b); i++)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define PB push_back
#define FS first
#define SD second
typedef pair<int, int> pii;
typedef vector<int> vi;
template<class X, class Y> X cmx(X &a, Y b) { a = max<X>(a, b); }
#define ary(k) array<int, k>
int n,k,h,a[200][200],p[1<<20],q[1<<20],f[30][200][200],x,y,A,w[1<<20],X[]={0,-1,0,0,1},Y[]={0,0,-1,1,0};
void Z(){
    cin>>n>>k>>h;
    if(n==0&&k==0&&h==0)
        exit(0);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            cin>>a[i][j];
    for(int i=1;i<=k;i++)
        cin>>p[i]>>q[i];
    for(int i=1;i<=h;i++)
        cin>>w[i];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            f[h][i][j]=a[i][j]>w[h];
    for(int k=h-1;~k;k--)
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++){
                f[k][i][j]=0;
                if(a[i][j]<=w[k])
                    continue;
                for(int l=0;l<5;l++)
                    f[k][i][j]|=1<=(x=i+X[l])&&x<=n&&1<=(y=j+Y[l])&&y<=n&&f[k+1][x][y];
            }
    A=0;
    for(int i=1;i<=k;i++)
        A+=f[0][p[i]][q[i]];
    cout<<A<<'\n';
}
signed main() {
	cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit);
    while(1)
        Z();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 9ms
memory: 7824kb

input:

3 1 3
2 1 2
3 1 3
2 4 2
1 1
0
2
1
2 4 2
0 1
1 2
0 0
0 1
1 1
1 0
1
0
50 50 24
5 20 21 3 2 9 22 15 19 22 18 14 19 14 15 4 22 22 7 12 7 2 2 0 25 0 7 6 4 3 2 17 1 12 7 12 1 19 12 3 23 5 5 10 22 15 17 3 13 4
10 21 7 12 10 22 23 18 17 5 17 18 2 14 12 13 13 19 19 18 8 11 3 0 24 0 6 1 9 12 14 13 20 22 5 13 ...

output:

1
0
1
1
1
0
0
94
97
74

result:

wrong answer 2nd lines differ - expected: '1', found: '0'