QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#426453#6515. Path PlanningyukinoWA 33ms3952kbC++171.0kb2024-05-31 11:52:172024-05-31 11:52:17

Judging History

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

  • [2024-05-31 11:52:17]
  • 评测
  • 测评结果:WA
  • 用时:33ms
  • 内存:3952kb
  • [2024-05-31 11:52:17]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define int ll
const int N=1e5+10;
using namespace std;
vector<int>f;
void dfs(vector<vector<int>>a,int n,int m,int i,int j)
{
    f.push_back(a[i][j]);
    if(i==n&&j==m)
        return;
    if(i+1<=n)
    {
        if(j+1<=m)
        {
            if(a[i+1][j]<a[i][j+1])
                dfs(a,n,m,i+1,j);
            else
                dfs(a,n,m,i,j+1);
        }
    }else
        dfs(a,n,m,i,j+1);
}
void solve()
{
   int n,m;
   cin>>n>>m;
   vector<vector<int>>a(n+1,vector<int>(m+1,0));

   for(int i=1;i<=n;i++)
   {
       for(int j=1;j<=m;j++)
       {
           cin>>a[i][j];
       }
   }
   f.clear();
  dfs(a,n,m,1,1);
  sort(f.begin(),f.end());
   for(int i=0;i<f.size();i++)
   {
       if(f[i]!=i)
       {
           cout<<i<<"\n";
           return;
       }
   }
   cout<<f.size()<<"\n";
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3560kb

input:

2
2 3
1 2 4
3 0 5
1 5
1 3 0 4 2

output:

3
5

result:

ok 2 number(s): "3 5"

Test #2:

score: -100
Wrong Answer
time: 33ms
memory: 3952kb

input:

10000
2 9
4 0 3 5 2 7 16 11 12
9 13 14 17 10 8 15 1 6
4 8
19 23 22 13 29 4 17 26
30 6 25 3 15 24 18 14
12 8 7 9 27 5 0 10
11 16 31 20 2 28 1 21
1 6
3 2 0 1 4 5
2 3
4 2 0
3 5 1
5 1
4
0
3
2
1
1 3
1 0 2
8 10
9 50 8 0 41 57 60 30 23 65
64 21 36 12 10 5 58 19 38 67
71 52 45 17 77 4 59 51 22 25
56 49 79 2...

output:

9
0
6
1
0
3
14
10
5
3
3
5
6
3
7
0
6
7
3
3
0
0
0
0
0
7
4
0
1
1
18
0
12
3
7
6
1
1
1
5
6
1
0
4
2
0
1
5
1
1
0
10
1
0
3
0
0
6
2
2
2
3
0
0
8
0
3
5
7
8
8
0
0
5
0
1
7
0
2
1
6
0
1
3
4
2
0
0
2
2
0
0
0
0
0
0
3
0
1
5
3
8
4
0
4
0
10
4
6
1
1
0
10
6
1
0
0
0
5
1
0
0
2
0
3
0
7
5
8
0
0
9
0
0
2
0
6
0
2
10
2
1
1
0
6
10...

result:

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