Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ad2cbd9

Browse files
Added more stuff
1 parent 359861d commit ad2cbd9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

‎Advanced Graphs/Newyear.cpp‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
3+
Name: Mehul Chaturvedi
4+
IIT-Guwahati
5+
6+
*/
7+
8+
9+
#include <bits/stdc++.h>
10+
using namespace std;
11+
12+
int main(){
13+
int n, t;
14+
cin >> n >> t;
15+
16+
// int **graph = new int*[n];
17+
// for(int i = 0; i < n; i++){
18+
// graph[i] = new int[n];
19+
// for(int j = 0; j < n; j++) graph[i][j] = 0;
20+
// }
21+
22+
int position = 0;
23+
24+
for(int i = 0; i < n-1; i++){
25+
if(position == t-1){
26+
cout << "YES" << endl;
27+
return 0;
28+
}
29+
int a;
30+
cin >> a;
31+
// graph[i][i+a] = 1;
32+
if(i == position) position += a;
33+
}
34+
35+
cout << "NO" << endl;
36+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /