Submission #793683

# Submission time Handle Problem Language Result Execution time Memory
793683 2023-07-26T05:31:04 Z vjudge1 Passport (JOI23_passport) C++14
6 / 100
34 ms 1876 KB
#include<bits/stdc++.h>
using namespace std ;
const int N = 2e5 ;
int n, q, l[N + 1], r[N + 1], x[N + 1] ;
int main()
{
    ios_base::sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
    cin >> n ;
    for(int i = 1 ; i <= n ; i++)
        cin >> l[i] >> r[i] ;
    cin >> q ;
    for(int i = 1 ; i <= q ; i++)
        cin >> x[i] ;
    if(q == 1 && x[1] == 1)
    {
        int ans = 0, mx = r[1], ind = 1 ;
        while(ind < n)
        {
            int mx1 = 0 ;
            for(int j = ind ; j <= mx ; j++)
                mx1 = max(mx1, r[j]) ;
            ans++ ;
            ind = mx ;
            if(mx1 == mx)
                break ;
            mx = max(mx1, mx) ;
        }
        if(ind < n)
            ans = -1 ;
        cout << ans ;
        return 0 ;
    }
    return 0 ;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 34 ms 1876 KB Output is correct
5 Correct 24 ms 1864 KB Output is correct
6 Correct 27 ms 1832 KB Output is correct
7 Correct 22 ms 1836 KB Output is correct
8 Correct 17 ms 1540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 34 ms 1876 KB Output is correct
5 Correct 24 ms 1864 KB Output is correct
6 Correct 27 ms 1832 KB Output is correct
7 Correct 22 ms 1836 KB Output is correct
8 Correct 17 ms 1540 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Incorrect 0 ms 212 KB Output isn't correct
11 Halted 0 ms 0 KB -