Submission #851501

# Submission time Handle Problem Language Result Execution time Memory
851501 2023-09-20T02:32:31 Z owoovo Passport (JOI23_passport) C++14
16 / 100
2000 ms 50560 KB
#include<bits/stdc++.h>
using namespace std;
const int maxn=3000;
int dp[2510][2510],n,q;
pair<int,int> ori[2510];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>ori[i].first>>ori[i].second;
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++)dp[i][j]=maxn;
    }
    dp[1][n]=0;
    for(int i=1;i<=n;i++){
        for(int j=n;j>=i;j--){
            for(int k=i;k<=j;k++){
                dp[i][j]=min(dp[i][j],dp[min(i,ori[k].first)][max(j,ori[k].second)]+1);
            }
        }
    }
    cin>>q;
    for(int i=1;i<=q;i++){
        int x;
        cin>>x;
        if(dp[x][x]==maxn){
            cout<<"-1\n";
        }else{
            cout<<dp[x][x]<<"\n";
        }
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Runtime error 153 ms 50560 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 11 ms 4440 KB Output is correct
12 Correct 15 ms 4440 KB Output is correct
13 Correct 13 ms 4440 KB Output is correct
14 Correct 11 ms 4444 KB Output is correct
15 Correct 15 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 11 ms 4440 KB Output is correct
12 Correct 15 ms 4440 KB Output is correct
13 Correct 13 ms 4440 KB Output is correct
14 Correct 11 ms 4444 KB Output is correct
15 Correct 15 ms 4444 KB Output is correct
16 Execution timed out 2037 ms 23388 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 11 ms 4440 KB Output is correct
12 Correct 15 ms 4440 KB Output is correct
13 Correct 13 ms 4440 KB Output is correct
14 Correct 11 ms 4444 KB Output is correct
15 Correct 15 ms 4444 KB Output is correct
16 Execution timed out 2037 ms 23388 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Runtime error 153 ms 50560 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -