# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
255939 |
2020-08-02T06:27:52 Z |
임성재(#5031) |
Joker (BOI20_joker) |
C++17 |
|
2000 ms |
14812 KB |
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define eb emplace_back
#define pre(a) cout<<fixed; cout.precision(a)
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const long long INF = 1e18;
const int inf = 1e9;
int n, m, q;
int l, r;
vector<pii> e;
vector<pii> g[200010];
int d[200010];
bool dfs(int x) {
for(auto i : g[x]) {
if(l <= i.se && i.se <= r) continue;
if(d[i.fi]) {
if(abs(d[x] - d[i.fi]) % 2 == 0) {
return true;
}
continue;
}
d[i.fi] = d[x] + 1;
if(dfs(i.fi)) return true;
}
return false;
}
int main() {
fast;
cin >> n >> m >> q;
for(int i=1; i<=m; i++) {
int u, v;
cin >> u >> v;
//g[u].eb(v, i);
//g[v].eb(u, i);
e.eb(u, v);
}
for(int i=0; i<e.size(); i++) {
g[e[i].fi].eb(e[i].se, i+1);
g[e[i].se].eb(e[i].fi, i+1);
}
while(q--) {
cin >> l >> r;
bool flag = false;
for(int i=1; i<=n; i++) {
d[i] = 0;
}
for(int i=1; i<=n; i++) {
if(d[i] == 0) {
d[i] = 1;
if(dfs(i)) flag = true;
}
}
if(flag) cout << "YES\n";
else cout << "NO\n";
}
}
Compilation message
Joker.cpp: In function 'int main()':
Joker.cpp:59:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<e.size(); i++) {
~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4992 KB |
Output is correct |
2 |
Correct |
3 ms |
4992 KB |
Output is correct |
3 |
Correct |
3 ms |
4992 KB |
Output is correct |
4 |
Correct |
3 ms |
4992 KB |
Output is correct |
5 |
Correct |
3 ms |
4992 KB |
Output is correct |
6 |
Correct |
3 ms |
4992 KB |
Output is correct |
7 |
Correct |
4 ms |
4992 KB |
Output is correct |
8 |
Correct |
6 ms |
4992 KB |
Output is correct |
9 |
Correct |
4 ms |
4992 KB |
Output is correct |
10 |
Correct |
3 ms |
4992 KB |
Output is correct |
11 |
Correct |
4 ms |
5104 KB |
Output is correct |
12 |
Correct |
4 ms |
4992 KB |
Output is correct |
13 |
Correct |
3 ms |
5120 KB |
Output is correct |
14 |
Correct |
4 ms |
4992 KB |
Output is correct |
15 |
Correct |
4 ms |
4992 KB |
Output is correct |
16 |
Correct |
4 ms |
4992 KB |
Output is correct |
17 |
Correct |
3 ms |
4992 KB |
Output is correct |
18 |
Correct |
3 ms |
4992 KB |
Output is correct |
19 |
Correct |
4 ms |
4992 KB |
Output is correct |
20 |
Correct |
3 ms |
4992 KB |
Output is correct |
21 |
Correct |
4 ms |
4992 KB |
Output is correct |
22 |
Correct |
4 ms |
4992 KB |
Output is correct |
23 |
Correct |
3 ms |
4992 KB |
Output is correct |
24 |
Correct |
4 ms |
4992 KB |
Output is correct |
25 |
Correct |
4 ms |
4992 KB |
Output is correct |
26 |
Correct |
3 ms |
4992 KB |
Output is correct |
27 |
Correct |
3 ms |
4992 KB |
Output is correct |
28 |
Correct |
4 ms |
4992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4992 KB |
Output is correct |
2 |
Correct |
3 ms |
4992 KB |
Output is correct |
3 |
Correct |
3 ms |
4992 KB |
Output is correct |
4 |
Correct |
3 ms |
4992 KB |
Output is correct |
5 |
Correct |
3 ms |
4992 KB |
Output is correct |
6 |
Correct |
3 ms |
4992 KB |
Output is correct |
7 |
Correct |
4 ms |
4992 KB |
Output is correct |
8 |
Correct |
6 ms |
4992 KB |
Output is correct |
9 |
Correct |
4 ms |
4992 KB |
Output is correct |
10 |
Correct |
3 ms |
4992 KB |
Output is correct |
11 |
Correct |
4 ms |
5104 KB |
Output is correct |
12 |
Correct |
4 ms |
4992 KB |
Output is correct |
13 |
Correct |
3 ms |
5120 KB |
Output is correct |
14 |
Correct |
4 ms |
4992 KB |
Output is correct |
15 |
Correct |
4 ms |
4992 KB |
Output is correct |
16 |
Correct |
4 ms |
4992 KB |
Output is correct |
17 |
Correct |
3 ms |
4992 KB |
Output is correct |
18 |
Correct |
3 ms |
4992 KB |
Output is correct |
19 |
Correct |
4 ms |
4992 KB |
Output is correct |
20 |
Correct |
3 ms |
4992 KB |
Output is correct |
21 |
Correct |
4 ms |
4992 KB |
Output is correct |
22 |
Correct |
4 ms |
4992 KB |
Output is correct |
23 |
Correct |
3 ms |
4992 KB |
Output is correct |
24 |
Correct |
4 ms |
4992 KB |
Output is correct |
25 |
Correct |
4 ms |
4992 KB |
Output is correct |
26 |
Correct |
3 ms |
4992 KB |
Output is correct |
27 |
Correct |
3 ms |
4992 KB |
Output is correct |
28 |
Correct |
4 ms |
4992 KB |
Output is correct |
29 |
Correct |
71 ms |
5120 KB |
Output is correct |
30 |
Correct |
114 ms |
5180 KB |
Output is correct |
31 |
Correct |
103 ms |
5120 KB |
Output is correct |
32 |
Correct |
67 ms |
5120 KB |
Output is correct |
33 |
Correct |
37 ms |
5172 KB |
Output is correct |
34 |
Correct |
117 ms |
5240 KB |
Output is correct |
35 |
Correct |
122 ms |
5120 KB |
Output is correct |
36 |
Correct |
30 ms |
5240 KB |
Output is correct |
37 |
Correct |
79 ms |
5120 KB |
Output is correct |
38 |
Correct |
75 ms |
5120 KB |
Output is correct |
39 |
Correct |
84 ms |
5120 KB |
Output is correct |
40 |
Correct |
56 ms |
5120 KB |
Output is correct |
41 |
Correct |
62 ms |
5120 KB |
Output is correct |
42 |
Correct |
58 ms |
5240 KB |
Output is correct |
43 |
Correct |
31 ms |
5120 KB |
Output is correct |
44 |
Correct |
55 ms |
5120 KB |
Output is correct |
45 |
Correct |
91 ms |
5308 KB |
Output is correct |
46 |
Correct |
110 ms |
5120 KB |
Output is correct |
47 |
Correct |
55 ms |
5120 KB |
Output is correct |
48 |
Correct |
76 ms |
5240 KB |
Output is correct |
49 |
Correct |
94 ms |
5120 KB |
Output is correct |
50 |
Correct |
114 ms |
5120 KB |
Output is correct |
51 |
Correct |
52 ms |
5120 KB |
Output is correct |
52 |
Correct |
73 ms |
5120 KB |
Output is correct |
53 |
Correct |
97 ms |
5120 KB |
Output is correct |
54 |
Correct |
124 ms |
5120 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4992 KB |
Output is correct |
2 |
Correct |
3 ms |
4992 KB |
Output is correct |
3 |
Execution timed out |
2086 ms |
13928 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4992 KB |
Output is correct |
2 |
Correct |
3 ms |
4992 KB |
Output is correct |
3 |
Correct |
3 ms |
4992 KB |
Output is correct |
4 |
Correct |
3 ms |
4992 KB |
Output is correct |
5 |
Correct |
3 ms |
4992 KB |
Output is correct |
6 |
Correct |
3 ms |
4992 KB |
Output is correct |
7 |
Correct |
4 ms |
4992 KB |
Output is correct |
8 |
Correct |
6 ms |
4992 KB |
Output is correct |
9 |
Correct |
4 ms |
4992 KB |
Output is correct |
10 |
Correct |
3 ms |
4992 KB |
Output is correct |
11 |
Correct |
4 ms |
5104 KB |
Output is correct |
12 |
Correct |
4 ms |
4992 KB |
Output is correct |
13 |
Correct |
3 ms |
5120 KB |
Output is correct |
14 |
Correct |
4 ms |
4992 KB |
Output is correct |
15 |
Correct |
4 ms |
4992 KB |
Output is correct |
16 |
Correct |
4 ms |
4992 KB |
Output is correct |
17 |
Correct |
3 ms |
4992 KB |
Output is correct |
18 |
Correct |
3 ms |
4992 KB |
Output is correct |
19 |
Correct |
4 ms |
4992 KB |
Output is correct |
20 |
Correct |
3 ms |
4992 KB |
Output is correct |
21 |
Correct |
4 ms |
4992 KB |
Output is correct |
22 |
Correct |
4 ms |
4992 KB |
Output is correct |
23 |
Correct |
3 ms |
4992 KB |
Output is correct |
24 |
Correct |
4 ms |
4992 KB |
Output is correct |
25 |
Correct |
4 ms |
4992 KB |
Output is correct |
26 |
Correct |
3 ms |
4992 KB |
Output is correct |
27 |
Correct |
3 ms |
4992 KB |
Output is correct |
28 |
Correct |
4 ms |
4992 KB |
Output is correct |
29 |
Execution timed out |
2086 ms |
13928 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4992 KB |
Output is correct |
2 |
Correct |
3 ms |
4992 KB |
Output is correct |
3 |
Correct |
3 ms |
4992 KB |
Output is correct |
4 |
Correct |
3 ms |
4992 KB |
Output is correct |
5 |
Correct |
3 ms |
4992 KB |
Output is correct |
6 |
Correct |
3 ms |
4992 KB |
Output is correct |
7 |
Correct |
4 ms |
4992 KB |
Output is correct |
8 |
Correct |
6 ms |
4992 KB |
Output is correct |
9 |
Correct |
4 ms |
4992 KB |
Output is correct |
10 |
Correct |
3 ms |
4992 KB |
Output is correct |
11 |
Correct |
4 ms |
5104 KB |
Output is correct |
12 |
Correct |
4 ms |
4992 KB |
Output is correct |
13 |
Correct |
3 ms |
5120 KB |
Output is correct |
14 |
Correct |
4 ms |
4992 KB |
Output is correct |
15 |
Correct |
4 ms |
4992 KB |
Output is correct |
16 |
Correct |
4 ms |
4992 KB |
Output is correct |
17 |
Correct |
3 ms |
4992 KB |
Output is correct |
18 |
Correct |
3 ms |
4992 KB |
Output is correct |
19 |
Correct |
4 ms |
4992 KB |
Output is correct |
20 |
Correct |
3 ms |
4992 KB |
Output is correct |
21 |
Correct |
4 ms |
4992 KB |
Output is correct |
22 |
Correct |
4 ms |
4992 KB |
Output is correct |
23 |
Correct |
3 ms |
4992 KB |
Output is correct |
24 |
Correct |
4 ms |
4992 KB |
Output is correct |
25 |
Correct |
4 ms |
4992 KB |
Output is correct |
26 |
Correct |
3 ms |
4992 KB |
Output is correct |
27 |
Correct |
3 ms |
4992 KB |
Output is correct |
28 |
Correct |
4 ms |
4992 KB |
Output is correct |
29 |
Correct |
71 ms |
5120 KB |
Output is correct |
30 |
Correct |
114 ms |
5180 KB |
Output is correct |
31 |
Correct |
103 ms |
5120 KB |
Output is correct |
32 |
Correct |
67 ms |
5120 KB |
Output is correct |
33 |
Correct |
37 ms |
5172 KB |
Output is correct |
34 |
Correct |
117 ms |
5240 KB |
Output is correct |
35 |
Correct |
122 ms |
5120 KB |
Output is correct |
36 |
Correct |
30 ms |
5240 KB |
Output is correct |
37 |
Correct |
79 ms |
5120 KB |
Output is correct |
38 |
Correct |
75 ms |
5120 KB |
Output is correct |
39 |
Correct |
84 ms |
5120 KB |
Output is correct |
40 |
Correct |
56 ms |
5120 KB |
Output is correct |
41 |
Correct |
62 ms |
5120 KB |
Output is correct |
42 |
Correct |
58 ms |
5240 KB |
Output is correct |
43 |
Correct |
31 ms |
5120 KB |
Output is correct |
44 |
Correct |
55 ms |
5120 KB |
Output is correct |
45 |
Correct |
91 ms |
5308 KB |
Output is correct |
46 |
Correct |
110 ms |
5120 KB |
Output is correct |
47 |
Correct |
55 ms |
5120 KB |
Output is correct |
48 |
Correct |
76 ms |
5240 KB |
Output is correct |
49 |
Correct |
94 ms |
5120 KB |
Output is correct |
50 |
Correct |
114 ms |
5120 KB |
Output is correct |
51 |
Correct |
52 ms |
5120 KB |
Output is correct |
52 |
Correct |
73 ms |
5120 KB |
Output is correct |
53 |
Correct |
97 ms |
5120 KB |
Output is correct |
54 |
Correct |
124 ms |
5120 KB |
Output is correct |
55 |
Execution timed out |
2080 ms |
14812 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4992 KB |
Output is correct |
2 |
Correct |
3 ms |
4992 KB |
Output is correct |
3 |
Correct |
3 ms |
4992 KB |
Output is correct |
4 |
Correct |
3 ms |
4992 KB |
Output is correct |
5 |
Correct |
3 ms |
4992 KB |
Output is correct |
6 |
Correct |
3 ms |
4992 KB |
Output is correct |
7 |
Correct |
4 ms |
4992 KB |
Output is correct |
8 |
Correct |
6 ms |
4992 KB |
Output is correct |
9 |
Correct |
4 ms |
4992 KB |
Output is correct |
10 |
Correct |
3 ms |
4992 KB |
Output is correct |
11 |
Correct |
4 ms |
5104 KB |
Output is correct |
12 |
Correct |
4 ms |
4992 KB |
Output is correct |
13 |
Correct |
3 ms |
5120 KB |
Output is correct |
14 |
Correct |
4 ms |
4992 KB |
Output is correct |
15 |
Correct |
4 ms |
4992 KB |
Output is correct |
16 |
Correct |
4 ms |
4992 KB |
Output is correct |
17 |
Correct |
3 ms |
4992 KB |
Output is correct |
18 |
Correct |
3 ms |
4992 KB |
Output is correct |
19 |
Correct |
4 ms |
4992 KB |
Output is correct |
20 |
Correct |
3 ms |
4992 KB |
Output is correct |
21 |
Correct |
4 ms |
4992 KB |
Output is correct |
22 |
Correct |
4 ms |
4992 KB |
Output is correct |
23 |
Correct |
3 ms |
4992 KB |
Output is correct |
24 |
Correct |
4 ms |
4992 KB |
Output is correct |
25 |
Correct |
4 ms |
4992 KB |
Output is correct |
26 |
Correct |
3 ms |
4992 KB |
Output is correct |
27 |
Correct |
3 ms |
4992 KB |
Output is correct |
28 |
Correct |
4 ms |
4992 KB |
Output is correct |
29 |
Correct |
71 ms |
5120 KB |
Output is correct |
30 |
Correct |
114 ms |
5180 KB |
Output is correct |
31 |
Correct |
103 ms |
5120 KB |
Output is correct |
32 |
Correct |
67 ms |
5120 KB |
Output is correct |
33 |
Correct |
37 ms |
5172 KB |
Output is correct |
34 |
Correct |
117 ms |
5240 KB |
Output is correct |
35 |
Correct |
122 ms |
5120 KB |
Output is correct |
36 |
Correct |
30 ms |
5240 KB |
Output is correct |
37 |
Correct |
79 ms |
5120 KB |
Output is correct |
38 |
Correct |
75 ms |
5120 KB |
Output is correct |
39 |
Correct |
84 ms |
5120 KB |
Output is correct |
40 |
Correct |
56 ms |
5120 KB |
Output is correct |
41 |
Correct |
62 ms |
5120 KB |
Output is correct |
42 |
Correct |
58 ms |
5240 KB |
Output is correct |
43 |
Correct |
31 ms |
5120 KB |
Output is correct |
44 |
Correct |
55 ms |
5120 KB |
Output is correct |
45 |
Correct |
91 ms |
5308 KB |
Output is correct |
46 |
Correct |
110 ms |
5120 KB |
Output is correct |
47 |
Correct |
55 ms |
5120 KB |
Output is correct |
48 |
Correct |
76 ms |
5240 KB |
Output is correct |
49 |
Correct |
94 ms |
5120 KB |
Output is correct |
50 |
Correct |
114 ms |
5120 KB |
Output is correct |
51 |
Correct |
52 ms |
5120 KB |
Output is correct |
52 |
Correct |
73 ms |
5120 KB |
Output is correct |
53 |
Correct |
97 ms |
5120 KB |
Output is correct |
54 |
Correct |
124 ms |
5120 KB |
Output is correct |
55 |
Execution timed out |
2086 ms |
13928 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |