# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
824359 |
2023-08-14T04:12:32 Z |
xink |
Passport (JOI23_passport) |
C++14 |
|
1 ms |
228 KB |
#include <iostream>
#include <vector>
#include <utility>
#include <sstream>
#include <climits>
#include <cstring>
#define ll long long
#define ld long double
using namespace std;
const ll mod = 1e9 + 7;
const int maxn = 2e5 + 5;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
ii range[maxn];
void solve()
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> range[i].first >> range[i].second;
range[i].first--, range[i].second--;
}
int q;
cin >> q;
while (q-- > 0)
{
int idx;
cin >> idx;
if (idx == 1)
{
int r = 0, cnt = 1;
while (r < n && range[r].second != r)
{
r = range[r].second;
cnt++;
}
cout << cnt << '\n';
}
}
}
int main()
{
// freopen("input_text", "r", stdin);
// freopen("output_text", "w", stdout);
// ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
int t = 1;
// cin >> t;
while (t-- > 0)
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
228 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 |
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 |
1 ms |
228 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |