# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1054581 |
2024-08-12T10:49:53 Z |
kititnik |
Joker (BOI20_joker) |
C++17 |
|
24 ms |
2396 KB |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005;
bool used[MAXN];
int cntrs[MAXN];
int graph[MAXN][MAXN];
bool ans = false;
bool is_checking(int l, int r, int street)
{
return (street <= r && street >= l);
}
void dfs(int v, int p, int counter, int n, int l, int r)
{
used[v] = true;
cntrs[v] = counter;
for(int i = 0; i < MAXN; i++)
{
if(i==v) continue;
if(i==p) continue;
int street = graph[v][i];
if(street == 0) continue;
if(is_checking(l, r, street)) continue;
if(used[i])
{
int distance = abs(counter - cntrs[i])+1;
if(distance % 2 != 0) ans = true;
}
else dfs(i, v, counter+1, n, l, r);
}
}
int main() {
int n, m, q;
cin >> n >> m >> q;
int v, u;
for(int i = 1; i <= m; i++)
{
cin >> v >> u;
graph[v][u] = i;
graph[u][v] = i;
}
for(int i = 0; i < q; i++)
{
int l, r;
cin >> l >> r;
memset(used, 0, sizeof(used));
memset(cntrs, 0, sizeof(cntrs));
dfs(v, -1, 1, n, l, r);
if(ans)
cout << "YES" << endl;
else cout << "NO" << endl;
ans = false;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
2396 KB |
Output is correct |
8 |
Incorrect |
24 ms |
2396 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
2396 KB |
Output is correct |
8 |
Incorrect |
24 ms |
2396 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
2396 KB |
Output is correct |
8 |
Incorrect |
24 ms |
2396 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
2396 KB |
Output is correct |
8 |
Incorrect |
24 ms |
2396 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
2396 KB |
Output is correct |
8 |
Incorrect |
24 ms |
2396 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |